Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Reading specific lines in a file

by Discipulus (Canon)
on May 20, 2014 at 08:34 UTC ( [id://1086749]=note: print w/replies, xml ) Need Help??


in reply to Reading specific lines in a file

if you are talking about linenumber $. is for you:
perl -ne 'print if ($. >= 10 and $. <=20 )' filename.ext

HtH
L*
UPDATE: perl -ne 'print if 15 .. 17' *.pod
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Reading specific lines in a file
by gurpreetsingh13 (Scribe) on May 20, 2014 at 08:47 UTC
    That's right. Tried it already using $.
    Just wanted to do something via a list context as a one-liner.
    Learning purpose you can say. Anyway, thanks a lot.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-03-29 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found