I want to extract only lines with specific line numbers from a file (I have about 20-50 line numbers, the file has 30,000 lines). So far, the shortest way I've found for this is, for example:
gawk 'BEGIN {split("13193,15791,16891", A, ",")} NR in A' <file_name>
but it looks like I should be able to further reduce input. I looked at sed, but it seems to me that for each line number I need -nboth -p, and also cat -ns grep, but this is in more detail than indicated above. Does anyone know a better way?
source
share