View Single Post
Old 12-13-2006, 07:36 AM  
drjones
Confirmed User
 
Join Date: Oct 2005
Location: Charlotte, NC
Posts: 908
Quote:
Originally Posted by micker View Post
ok, if all the files are in the same directory you can just run this...

cat * | sed 's/$FIND/$REPLACE/g'

change $FIND to what you want to match and $REPLACE with what you want to change it to.
For a slightly safer version of that command, that will back up your files, and only try to modify .html files, try this.. should run from the document root of your webserver.


perl -pi'.orig' -e 's/$FIND/$REPLACE/g' `find ./ -name "*.html"`

It will back up the all the original files with a .orig extension as it runs, so if you make a mistake with the regex you can start over. The files with the text substitution will have the original file name.
__________________
ICQ: 284903372

Last edited by drjones; 12-13-2006 at 07:37 AM..
drjones is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote