Web Hosting Talk







View Full Version : search and replace tool?


protector330
03-28-2002, 11:24 AM
hello :) is there a command for the shell to say something like:


search for XY and replace it to YZ?


I've about 200 files which could contain a path which has changed... do not want to check file after file after file manually.

or can I use grep somehow to have at least a list of all the files containing the wrong path?

thanks a lot!

allan
03-28-2002, 11:30 AM
Dizix and I wrote one on a thread a couple of months ago:

http://www.webhostingtalk.com/showthread.php?s=&threadid=34600

Does that do what you want :)

bitserve
03-28-2002, 07:38 PM
Here too:

http://www.webhostingtalk.com/showthread.php?s=&threadid=39530

allan
03-28-2002, 07:42 PM
Originally posted by bitserve
Here too:

http://www.webhostingtalk.com/showthread.php?s=&threadid=39530

Oh, sure Mark, can't just let me show off my meager programming skills without jumping in :D.

bitserve
03-30-2002, 04:15 AM
Your thread was fine.

I actually wonder how I missed it the first time around, since I was on this forum then. It's just the perl without the find. I simply don't know if that will do. :)

And then you guys started doing the -exec with the find.

And then hypernatic and tim started doing the 10 lines of code.

Sheesh. There has to be a better way.

;)