Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: extract (a range of) numbered lines from a file -- let's say 20 char oneliner

by Discipulus (Canon)
on Sep 21, 2016 at 20:27 UTC ( [id://1172327]=note: print w/replies, xml ) Need Help??


in reply to Re^2: extract (a range of) numbered lines from a file -- smarter oneliner 22chars
in thread extract (a range of) numbered lines from a file

Let's say 20..
perl -E "say+(0,<>)[eval pop]" linenumber.txt 1,3..5

I was sure to have tested the empty diamond, but evidently not.. ;=)

L*

PS 19 chars if I can cheat:

perl -snlE "say if $.~~[eval$R]" -- -R="2,3..5" linenumber.txt

L*

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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found