This question already has an answer here:
I have a very big text file, about 80GB, and I need to cut a part form it that lies between two given lines. The part I need is not big, and I have not enough space left on the hard drive to do things like:
head -n 10000000 filename > auxiliary_part tail -n 1000 auxiliary_part > needed_part
How do I do that?