Re: unhead
Josh Goldberg <[email protected]>
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <[email protected]> |
Here's a little oneliner to skip the first 5 lines of the file 'foo': perl -i5 -e '@_=<STDIN>;print@_[$^I..$#_]' < foo On Sep 24, 2004, at 7:17 AM, Jose Alves de Castro wrote: > You're probably all familiar with the commands "head" and "tail", which > let you extract the first or the last N lines of input or a file... > > Imagine you want to print a file, but without the first N lines... > > For N=1, one possibility would be: > > print if $. - 1; > > For any N, maybe this: > > print if ($N+1)..0; > > Any thoughts? Any other ideas? What would be the best way to do this? > > > Regards, > > jac > > -- > José Alves de Castro <[email protected]> > http://natura.di.uminho.pt/~jac