McLinux on 4 Dec 2003 23:37:02 -0500


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

Re: [PLUG] search and replace multiple files?




Alex Birch wrote:

John Fiore wrote:

This post was from a while ago.  I saved it because I
thought that it might come in handy.

      perl -pie 's/foo/bar/' file1

I get the error:
     Can't open perl script "s/foo/bar/": No such file
or directory

I'm using bash, but the same thing occurs if I'm using
tcsh.  I'm probably doing something stupid.  Any
ideas?


Try use perl -p -i -e 's/foo/bar/' file1

I think the flag 'g' is missing here. The above command should be written as perl -pi -e 's/foo/bar/g' file1.


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


- McLinux


--
... Microsoft should switch to the vacuum cleaner business where people actually want products that suck.


--


___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug