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