$ cat file.txt | perl -ne '(1..10)&&print'
or
#!/usr/bin/perl my $counter; open A, 'file.txt'; while(<A>) { print if ($counter++ < 10); } close A;
In reply to Re: I feel stupid.
by japh
in thread Read n lines from the top of a text file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |