gabriel rosenkoetter on 17 Nov 2003 12:08:02 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] search and replace multiple files?


On Mon, Nov 17, 2003 at 08:59:32AM -0800, Marc Zucchelli wrote:
> before i resort to writing a quick perl script, does
> anyone know if this is possible via command line?  I
> have close to 100 files that i need to search and
> replace.

ed(1) in a for (syntax dependent on your shell) loop should do this.

Some thing like this:

for i in * ; do printf 's/foo/bar/\nwq\n' | ed $i ; done 

-- 
gabriel rosenkoetter
gr@eclipsed.net

Attachment: pgpyUAPKrWHnO.pgp
Description: PGP signature