[ILUG] Global Search Replace

Jeremy Smyth JSmyth at Braxtel.com
Thu Sep 7 17:17:47 IST 2000


>  what I'm trying to do is replace all occurances of 
> AAA with BBB
> in all the html documents under a certain directory...

perl -i.bak -p -e "s/AAA/BBB/g" *.html

will copy files to *.html.bak , and replace all occurrences of AAA with BBB.
You could stick an "i" in the options (with the g above) to ignore case.

> I think you can do this with sed, find, grep etc but don't 

sed has some similar way of doing it -  I think it's pretty much the same.

/jer




More information about the ILUG mailing list