cat -n text.txt
$ cat -n file | awk '$1>=4 && $1<=8 || $1==12 || $1==42' 4 Line 4 5 Line 5 6 Line 6 7 Line 7 8 Line 8 12 Line 12 42 Line 42
awk 'NR==1' file.txt