version 1.0.0, 2013-10-19 : Initial version
wc -l using perl one-liners
Perl one-liners to rewrite a wc -l.This shell command returns the number of lines contained by a file.
perl -lne '}{print$.' file_input.txt
The above command is the exact same one but in a more human readable way:
perl -lne 'END{print$.}' file_input.txt
The $.
variable contains the line number of the line currently been read.
And as the END code block is executed after perl finished running the program
and just before the interpreter is being exited, the $.
variable contains the
number of the last line of the file ⇒ the number of lines in the file. Easy! :)