On Thu, 21 Mar 2002, Nick Wilson wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi everyone, 
> could someone please help me solve the following problem?
> 
> I need to recursively find and replace a string in a whole bunch of dirs
> (a website). For example: 
> 
> change: http://my-testing-environment.com
> to:     http://www.the-real-website.com
> 
> I gues sed is the tool for this right? I've read the man page but I'm
> somewhat intimidated by it :-)

 No, for this perl is the "best" tool ...

        find . -type f | xargs perl -npi.orig -e 's#old#new#g;'

 It's a lot more efficient as it can process multiple files per
forked process, and you actually put code in the expression there
(the -e part) that is applied to every line as the file is read
in, and then is written out again.




_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to