Perl one-liner for text replacement
Perl one-liners contain a single command terminated with a semi-colon, followed by a list of the files that it should operate on.
Here is an example, which removes a reference to a file name 1169048439 inside a file:
perl -wpl -e 's/1169048439\///g;' 1169048439
The above will only print to the screen. If you want to replace the file with the corrected file one way to do it is to say
perl -wpl -e 's/1149008916\///g;' 1149008916 > tempo
and then
mv tempo 1149008916
Writing the output directly on top of the modified file creates a blank file in Centos 4
Here is an example, which removes a reference to a file name 1169048439 inside a file:
perl -wpl -e 's/1169048439\///g;' 1169048439
The above will only print to the screen. If you want to replace the file with the corrected file one way to do it is to say
perl -wpl -e 's/1149008916\///g;' 1149008916 > tempo
and then
mv tempo 1149008916
Writing the output directly on top of the modified file creates a blank file in Centos 4

0 Comments:
Post a Comment
<< Home