Gerald Wheeler wrote:
All,
Hello,
How would I use something like this: perl -pei
's/mailto:[EMAIL PROTECTED]/mailto:[EMAIL PROTECTED] Comment
Concerning Page: <filename>/g' `find ./ -name *.html *.htm`
To recursively (in current and all subdirectories) find and replace
this: mailto:[EMAIL PROTECTED] with this: mailto:[EMAIL PROTECTED]
Comments Concerning Page: <filename>
<filename> is the current file
This does not work:
find. -name \*.html -exec perl -nie
's/mailto:[EMAIL PROTECTED]/mailto:[EMAIL PROTECTED] Comments
Concerning Page: $ARGV[0]/' {} \;
You have four problems that I can see: 1) You are using the switches
incorrectly, both -i and -e use what immediately follows as part of the
switch, so -pei means that 'i' is the program that perl runs and -nie
means that 'e' is the extention used for the backup file; 2) In the
second example you use the -n switch which means that nothing is printed
out to the file; 3) The @ character in interpolated in double quoted
context and the array @abc is not defined in your program; and 4) You
use $ARGV[0] but the current file name is in $ARGV.
You probably want something like:
find. -name \*.html -exec perl -i
-pe's/mailto:[EMAIL PROTECTED]/mailto:[EMAIL PROTECTED] Comments
Concerning Page: $ARGV/g' {} \;
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/