Warning: rank newbie here.

I have a series of ascii files, like file0037.txt file0038.txt
file0039.txt etc.
I have a statement somewhere within every file that goes like:
Select * from stuff into selection

How do I modify/replace this statement in each file to reflect the
last 2 digits of the filename?

file0037.txt - should contain
Select * from stuff where thing="37" into selection
file0038.txt - should contain
Select * from stuff where thing="38" into selection
file0039.txt - should contain
Select * from stuff where thing="39" into selection

Thanks,
Ross