From owner-freebsd-questions Wed Apr 18 16: 8: 5 2001 Delivered-To: freebsd-questions@freebsd.org Received: from tortugas.irbs.com (tortugas.irbs.com [216.86.160.243]) by hub.freebsd.org (Postfix) with ESMTP id 1B38637B422 for ; Wed, 18 Apr 2001 16:08:02 -0700 (PDT) (envelope-from jc@irbs.com) Received: by tortugas.irbs.com (Postfix, from userid 108) id 6D2F413627; Wed, 18 Apr 2001 19:07:51 -0400 (EDT) Date: Wed, 18 Apr 2001 19:07:51 -0400 From: John Capo To: Laurence Berland Cc: questions@freebsd.org Subject: Re: OT:Use perl to substitute a string for another in many files Message-ID: <20010418190751.A25209@tortugas.irbs.com> Reply-To: jc@irbs.com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from laurence@isp.northwestern.edu on Wed, Apr 18, 2001 at 05:25:19PM -0500 X-Organization: IRBS Engineering, inc. 954-463-3771 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I use something like this: find blah.... | xargs perl -pi -e 's/a-string/b-string/g' John Capo Quoting Laurence Berland (laurence@isp.northwestern.edu): > If I've got a bunch of files, that I can list using find, what is the best > way, using perl, to substitute every instance of a string with a different > string in all these files. > > Basically I want to run s/a-string/b-string/g in place on each file. > > Any ideas? I have already hosed some files messing this up once, and > don't want to risk doing it again. > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message