[thelist] SOLVED: Making same modification to large number of files

Barney Carroll barney at textmatters.com
Fri Feb 9 10:30:28 CST 2007

Joel D Canfield wrote:
> so, I was hoping that, rather than just finding an elaborate solution
> which you'll just have to use again next time, you'd find an elaborate
> solution you could use just once, make the footer an server side
> include, and then next time, just change the include instead of all the
> files.

Sorry Joel, I'm not deciphering this!

I had a few hundred pages of static, hard-coded HTML on a unix machine I 
was accessing through ssh - and all of them had an identical piece of 
text that needed the same modification across the board.

The program I used meant that I iterated the modification once, and it 
instantly searched and replaced for all those files.

All it required was creating a small file with particular sed syntax, 
mostly consisting of the string I was searching for and the string I 
wanted to substitute, and then I told sed to run this file, which did 
all the work.

It was pretty easy. Turns out there is a perl version of sed which can 
do the same thing without the messiness of having to create a file, but 
I'm not really that bothered.


More information about the thelist mailing list