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

Nice!

perl -e "print +(0,<ARGV>)[eval pop]" linenumber.txt 1,3..5

You can omit the ARGV, and the blank after print, too:

perl -e "print+(0,<>)[eval pop]" linenumber.txt 1,3..5

22 :-)

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
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
    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.