I have been using the Perl command line with a -ne
option for years, largely to process text files in ways that sed can't. Example:
cat in.txt | perl -ne "s/abc/def/; s/fgh/hij/; print;" > out.txt
I have no idea where I learned this, and have only today read perlrun and found there are other forms (perl -pe
for example).
What else should I know about perl -ne
?
My favorite reference for Perl one liners (and the top hit on Google for that phrase) covers
perl -ne
: http://novosial.org/perl/one-liner/