Hello again.
The other day I needed to replace a sponser code on all of my sites.
As I put all of my sites in a domain, that task was very easily done with a single linux command with the help of perl. Lets see how.
I am on directory /home/mydomain.com
and wanted to change the url
http://www.old.com to
http://www.new.com on all of my sites wich are located in directories of /home/mydomain.com
how I did this?
with this code:
perl -p -i -e 's/oldcode/newcode/g' `find ./`
with this code do is actually go thru all of your files of all your subdirectories, and whenever it founds the string oldcode it replaces with the newcode.
please not you need to escape with a \ all of these chars: \ . & and some other.
the final code for this one would be this:
perl -p -i -e 's/http:\/\/\/www\.old\.com/http:\/\/\/www\.new\.com/g' `find ./`
if you want just to replace your files in the current dir, just replace `find ./` with *
hope i saved some of you guys a lot of work
------------------
______ All Boys Do What They Have To Do ______
http://www.powergirlz.com/webmasters
______________________________________________