in reply to how to print first 5 lines of a file
perl -pe 'close ARGV if $. == 5' file1 file2 ...
Update: The code above fails if one if the files is less than 5 lines long! This works better:
perl -pe 'close ARGV if $. == 5 or eof' file1 file2 ...
buckaduck
|
|---|