Editing multiple files with one script
ORIGINALLY POSTED BY OPUS FOR THETAZZONE/TAZFORUM HERE
Do not use, republish, in whole or in part, without the consent of the Author. TheTAZZone policy is that Authors retain the rights to the work they submit and/or post…we do not sell, publish, transmit, or have the right to give permission for such…TheTAZZone merely retains the right to use, retain, and publish submitted work within it’s Network
I wrote some code a few years back, basically it was channel services for IRC. It has about 96 .c files that are compiled into a single binary. Each file contains copyright info at the top, so rather than edit each file one at a time to modify the copyright each year, I wrote a script to do it for me.
for x in *.c
ed -s $x << end
g/some string/s//to some other string/g
Of course you can modify it to suit your need to edit other type files. The key being each file contains “some string”