where numbers.txt is merely a document with the numbers 7 and 8
My guess is that I need a way of piping the output from ls (of the directory) into where the inputfile is situated and a counter to loop through till the end.
Any suggestions will be welcome (an awk suggestion would be preferable to pearl)
The second line in Jim's script (and mine, too) moves the tmp file back over the original file. You can't easily redirect back onto a file because the redirection happens before awk gets to read it, so the file ends up being empty. There are various ways to avoid using temporary files but in this particular case it's probably not worth the hassle.