Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 2015-07-07 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls