[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] find/replace ever instance of X with Y in *
- Subject: [ale] find/replace ever instance of X with Y in *
- From: jasonday at worldnet.att.net (Jason Day)
- Date: Tue, 23 Jan 2007 09:33:36 -0500
- In-reply-to: <1169508538.16133.3.camel@localhost>
- References: <1169508538.16133.3.camel@localhost>
On Mon, Jan 22, 2007 at 06:28:58PM -0500, Jim Popovitch wrote:
> I periodically need a utility to change multiple instances of X with Y
> in files Z. I know that combinations of awk/sed/grep can do some of
> this, but is there a way with one tool to do this?
perl -p -i -e 's/X/Y/g' Z
Z can be a single filename, a list of filenames, a glob, or program
output. E.g.:
perl -p -i -e 's/foo/bar/g' `find . -name \*.html`
HTH,
Jason
--
Jason Day jasonday at
http://jasonday.home.att.net worldnet dot att dot net
"Of course I'm paranoid, everyone is trying to kill me."
-- Weyoun-6, Star Trek: Deep Space 9