gabriel rosenkoetter on 5 Dec 2003 12:02:02 -0500


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

Re: [PLUG] search and replace multiple files?


On Fri, Dec 05, 2003 at 10:04:31AM +0530, McLinux wrote:
> I think the flag 'g' is missing here.
> The above command should be written as
> perl -pi -e 's/foo/bar/g' file1.

Only if you actually want to replace every instance of 'foo' with
'bar' within a given line. (You may very well not.)

> BTW Which perl version are you using? The above has been tested with 
> Perl 5.8.0.

That command should work in any Perl 5, unless -i was added with
5.6.

Certainly the regexp portion hasn't ever changed.

-- 
gabriel rosenkoetter
gr@eclipsed.net

Attachment: pgpgEmZoKz21u.pgp
Description: PGP signature