perl - Quickest/most concise bash one-liner for extracting specified lines from a file -
i want extract lines specific line numbers file (i have 20-50 line numbers, file has 30,000 lines). far, concise way i've found e.g.:
gawk 'begin {split("13193,15791,16891", a, ",")} nr in a' <file_name>
but seems should able further reduce amount of typing involved. i've looked @ sed
think need -n
, -p
each line number, thought cat -n
grep
it's more verbose above. know better way?
sed can more concise:
sed -n "13193p;15791p;16891p" file_name
Comments
Post a Comment