delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Message-ID: | <403433AE.DBA127FD@dessent.net> |
Date: | Wed, 18 Feb 2004 19:55:26 -0800 |
From: | Brian Dessent <brian AT dessent DOT net> |
Organization: | My own little world... |
MIME-Version: | 1.0 |
To: | "'cygwin-list'" <cygwin AT cygwin DOT com> |
Subject: | Re: search and replace tool |
References: | <BAY12-DAV60bvKoq4bY000378bd AT hotmail DOT com> |
X-IsSubscribed: | yes |
Reply-To: | cygwin AT cygwin DOT com |
Rafael Kitover wrote: > > 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. And if you're expecting a LOT of files and/or files with odd characters (e.g. space, quote) in their filenames, try this variant: find /where -name \*.txt -print0 | xargs -0 perl -pe 's/old/new/` Brian -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |