I used to
head a file and
tail the result in order to get the middle of a file
head -1000 bigfile | tail -20
The disadvantages is that you need to get 1000 lines in order to get 20 lines at the end !
I study a little bit
sed commands and found out this:
sed -n '980,1000p' bigfile
This is equivalent and faster ;) (try to time it)
-n is to not print the non selected lines
p stand for print
You also can:
sed -n '980,1000!d' bigfile
To not delete the lines selected. I didn't try to benchmark this solution compare to the previous one, but the action seems bigger (i.e.
delete a lot of lines vs
select few lines)