On May 29, Me said:

>If you will allow perl to make use of temporary files
>behind the scenes (which is normally perfectly ok),
>Cookbook recipe 7.9 is a whole heck of a lot
>simpler. As a command line one liner:
>
>    perl -pie 's/a/p/g' try.txt foo.txt
>
>will go thru files try.txt and foo.txt and rewrite them
>with every occurence of 'a' replaced with 'p'.

>Try it -- you'll like it!

Actually, it'll say:

  Can't open perl script "s/a/p/g": No such file or directory

You need to do

  perl -pi -e 's/a/p/g' ...

The reason is because -i takes a string after it of the extension to use,
so Perl thought you wanted to use "e" as the suffix of the backup files,
and there was no -e option found.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
** I need a publisher for my book "Learning Perl's Regular Expressions" **

Reply via email to