I want to be able to prepend a string to the beginning of each text file in a folder. How can I do this using bash on Linux?
You can do it like this without a loop and cat
cat
sed -i '1i whatever' *
if you want to back up your files, use -i.bak
Or using awk
awk
awk 'FNR==1{$0="whatever\n"$0;}{print $0>FILENAME}' *