R
RyanY
Hello,
I am wondering if it is possible to pipe input to the -i command line
switch. For example:
perl -i -pe'orig_*' 's/string/newString/g' file1
will change all occurances of "string" with "newString" and create a
file called "orig_file1" that will be the original file. How do I pipe
the output of ls to this?
The following doesn't work.
ls *.txt|perl -i -pe'orig_*' 's/string/newString/g'
I have read the perlfaq5 and understand how to do this within a perl
script. However, I came across the -i command line switch and wanted
to know if I could just pipe the filenames to it.
Thanks,
Ryan
I am wondering if it is possible to pipe input to the -i command line
switch. For example:
perl -i -pe'orig_*' 's/string/newString/g' file1
will change all occurances of "string" with "newString" and create a
file called "orig_file1" that will be the original file. How do I pipe
the output of ls to this?
The following doesn't work.
ls *.txt|perl -i -pe'orig_*' 's/string/newString/g'
I have read the perlfaq5 and understand how to do this within a perl
script. However, I came across the -i command line switch and wanted
to know if I could just pipe the filenames to it.
Thanks,
Ryan