If I have a file with 100,000 lines, how can I print lines in a specified range, such as lines 15010 to 15020?
Advertisement
Answer
sed
:
$ sed -n '15010,15020p' input.txt
awk
:
$ awk '15010<=NR && NR <=15020' input.txt
head/tail
:
$ head -n 15020 input.txt | tail -n $((15020-15010+1))