[oclug] tr help
Dave O'Neill
dmo at magma.ca
Fri Nov 14 19:13:45 EST 2003
On Fri, Nov 14, 2003 at 06:29:33PM -0500, Bob Lockie wrote:
> # find . -name \*.html | xargs perl -ipe 's{\\}{/}g'
> Can't open perl script "s{\\}{/}g": No such file or directory
Try:
find . -name \*.html | xargs perl -pi -e 's{\\}{/}g'
When grouping commandline options together with Perl, -i needs to be the
last option in the group if you want to edit files in-place. Otherwise,
-i assumes that anything immediately following it is to be used as a
file extension for backing up the original file. In the original
suggestion, Perl expected that you meant to provide the 'e' as the
filename extension, and then tried to interpret 's{\\}{/}g' as the name
of the script to run.
If you want to preserve a backup copy of your files before mangling them
with that Perl script, you could use:
find . -name \*.html | xargs perl -pi.orig -e 's{\\}{/}g'
This would create a backup of each of the .html files you're modifying
by appending a .orig extension to the existing filename.
Cheers,
Dave
More information about the OCLUG
mailing list