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

Re: reading the file using the line number

by Fengor (Pilgrim)
on Nov 29, 2006 at 09:18 UTC ( #586645=note: print w/ replies, xml ) Need Help??


in reply to reading the file using the line number

inspired by tom christiansens oneliners:

perl -ne 'print if $. == $number; exit if $. > $number;'

Edit: corrected typo, thx to davorg

--
"WHAT CAN THE HARVEST HOPE FOR IF NOT THE CARE OF THE REAPER MAN"
-- Terry Pratchett, "Reaper Man"


Comment on Re: reading the file using the line number
Download Code
Re^2: reading the file using the line number
by davorg (Chancellor) on Nov 29, 2006 at 10:20 UTC
    perl -ne 'print if $. = $number; exit if $. > $number;'

    You probably want '==', not '=', there.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-09-19 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (137 votes), past polls