Home : General : Internet Technologies :

General: Internet Technologies: Re: [brewt] How to search and replace with grep?: Edit Log

Here is the list of edits for this post
Re: [brewt] How to search and replace with grep?
in case anyones interested this is what i ended up using....

starting in a directory, run the following code (with your own paths etc) and it will go through all the files and folders recursively below that point replacing all the found instances with your new path.

Code:
find . -exec grep -l "/path/you/want/to/find" {} \; | xargs perl -p -i -e 's/\/path\/you\/want\/to\/find/\/path\/to\/replace\/it\/with/';

Unfortunately it will spit a list of the folders it finds back at you - if anyone knows how to stop that please let me know! :)

cheers!

r

Last edited by:

ryel01: Mar 13, 2004, 7:04 PM

Edit Log: