by AceJohnny2 · 6y ago · 0 comments
perl -ne "print $_;"
'-n' will run the expression over each line of the input. This is the Awk-like mode. perl -pe "s/foo/bar/"
'-p' will run the expression over each line of input, and print out the (possibly modified) line. This is the Sed-like mode.Slightly more info available in `man perlrun` or https://perldoc.perl.org/perlrun.html
perl -plane 'my $script'
which iterates over all files given on the command-line (or stdin) and + (p)rints every processed line back out
+ deals with (l)ine endings, in and out
+ (a)utosplits every line into @F
I am aware that -n and -p are mutually exclusive, but as -p overrides -n, it's seems simpler to just keep 'plane' in mind and remove the 'p' if necessary.