Friday, July 8, 2011

Perl one liner for In-Place editing.

Three perl single liner for In-Place editing. In all of the cases, the command replaces all occurrence of word 'target' with 'replace'.

With backup.
$ perl -pe 's/target/replace/g' < input.txt > output.txt
$ perl -i.bak -pe 's/target/replace/g' inout.txt
With out backup. 
$ perl -i -pe 's/target/replace/g' input.txt

1 comment:

  1. this kind of work gets me all jumbled up but ever since i started getting guidance from professional essay writing services i improved a lot. and your post just sums the whole thing together for me. keep posting

    ReplyDelete