in reply to Printing specific line numbers
Which, when the whitespace is fully condensed, leaves you with:perl -e '$cond = join " || ", map { "($_ .. \$. == $_ + 2)" } do { loc +al @ARGV = shift; <> }; eval qq{ while(<>) { print if $cond } };' lin +es test.txt
perl -e'$cond=join"||",map{"($_..\$.==$_+2)"}do{local@ARGV=shift;<>};e +val"($cond)&&print while<>"' lines test.txt
|
|---|