I'm trying to add a string to the beginning of many files, creating a new file extension whilst maintaining the filename.
cat string.txt file001.old > file001.new
cat string.txt file002.old > file002.new
cat string.txt file003.old > file003.new
etc...
I tried to batch it by:
for i in *.old
do
cat string.txt $i > $i.new
done
But this didnt exactly work, my skills are limited... Thanks in advance for any help.
string.txt
a file (if not, you need toecho
the string). Or do you have new files with names likefile002.old.new
? Or do you have filenames with spaces that get mixed up? – Walter A