delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/02/18/15:15:07

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
X-Originating-IP: [208.54.143.1]
X-Originating-Email: [rkitover AT hotmail DOT com]
X-Sender: rkitover AT hotmail DOT com
From: "Rafael Kitover" <caelum AT debian DOT org>
To: "'cygwin-list'" <cygwin AT cygwin DOT com>
Subject: RE: search and replace tool
Date: Wed, 18 Feb 2004 12:13:38 -0800
MIME-Version: 1.0
In-Reply-To: <291592011.20040218205953@thequod.de>
Message-ID: <BAY12-DAV60bvKoq4bY000378bd@hotmail.com>
X-OriginalArrivalTime: 18 Feb 2004 20:13:42.0171 (UTC) FILETIME=[B42B76B0:01C3F65B]

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 AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019