Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: A little script that combines `head' and `tail' utilities

by Aristotle (Chancellor)
on Sep 17, 2004 at 07:24 UTC ( #391697=note: print w/replies, xml ) Need Help??


in reply to A little script that combines `head' and `tail' utilities

Or you could just use the toolbox.

$ sed -n 10,20p somefile $ sed -n 40,/foo/p somefile $ sed -n /foo/,/bar/p somefile

Although that's less fun I suppose. Fine, let's do it in Perl.

$ perl -ne'print if 10 .. 20' somefile $ perl -ne'print if 40 .. /foo/' somefile $ perl -ne'print if /foo/ .. /bar/' somefile

Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://391697]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2021-10-18 01:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (72 votes). Check out past polls.

    Notices?