search and replace tool

Rafael Kitover caelum@debian.org
Wed Feb 18 20:27:00 GMT 2004


Not really cygwin specific, you can do something like:

perl -pi -e 's/old text/new text/' `find /where -name '*.txt'`

note those are backticks surrounding the find.

Use -pi.bak to make backup files in case you screw up. You will of course need
to know how to use regular expressions (see man perlretut). If you need to do
multiline replaces, you should probably write a script, or use some other
solution.

-- 
Rafael

>-----Original Message-----
>From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On Behalf Of
>dAniel hAhler
>Sent: Wednesday, February 18, 2004 12:00 PM
>To: cygwin-list
>Subject: search and replace tool
>
>Hello cygwin-list,
>
>I'm looking for a search and replace tool to replace a text portion in
>a bunch (3500+) of files.
>
>That should be an easy one.. :)

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list