Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: reading the file using the line number

by Fengor (Pilgrim)
on Nov 29, 2006 at 09:18 UTC ( [id://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"

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://586645]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2024-03-28 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found