# Last line of a file perl -pe '$*=$_}{$_=$*' file #### perl -pe '$*||=$_; $\=$_}{$_=$*' file #### # Exit after first match perl -ne 'print; last if /foo/' file
## perl -pe '$*||=$_; $\=$_}{$_=$*' file ##
## # Exit after first match perl -ne 'print; last if /foo/' file