View Single Post
Old 09-16-2006, 05:37 PM  
fatdicksimon
Confirmed User
 
Join Date: Feb 2006
Posts: 226
you can use sed to do a search and replace as well if that perl script isn't working. syntax is as follows:

sed 's|oldtext|newtext|g' -i filename

that will search filename for oldtext and replace it with newtext. make sure to escape any single quotes within the containing single quotes as well.

for multiple files, as far as i know, you must specify a file extension, but you can use the * symbol to search and replace a bunch.

so you will probably want to navigate to the containing directory, then do as follows:

sed 's|oldtext|newtext|g' -i *.php

of course you can do

sed 's|oldtext|newtext|g' -i /otherdirectory/*.php

if you want to find and replace a file in another directory.

when you first mess around with it, you may only want to check one file and make a backup of it to check the results.

sed runs quickly and is very useful. do a 'man sed' command for more info.

hope that helps!
__________________
icq: 199791893
holler at me
fatdicksimon is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote