in reply to Re: perl one liner to print a line
in thread perl one liner to print a line

You can exit sooner with
perl -ne'print, last if $. == 4'

Replies are listed 'Best First'.
Re^3: perl one liner to print a line
by jwkrahn (Abbot) on Dec 12, 2008 at 07:05 UTC

    I prefer:

    perl -ne'print and close ARGV if $. == 4' file.txt

    It works better with multiple files on the command line.      ;-)