“
For example, to print the lines 13, 19, 88, 290, and 999, you do this: perl -ne 'print if $. == 13 || $. == 19 || $. == 88 || $. == 290 || $. == 999' If you want to print more lines, you can put them in a separate array and then test whether $. is in this array: perl -ne ' @lines = (13, 19, 88, 290, 999, 1400, 2000); print if grep { $_ == $. } @lines ' This one-liner uses grep to test if the current line $. is in the @lines array. If the current line number is found in the @lines array, the grep function returns a list of one element that contains the current line number and this list evaluates to true.
”
”