cat line X to line Y on a huge file

view story

http://unix.stackexchange.com – Say I have a huge text file (>2GB) and I just want to cat the lines X to Y (e.g. 57890000 to 57890010). From what I understand I can get a somewhat similar behavior by piping head into tail or viceversa, i.e. head -A /path/to/file | tail -B or alternatively tail -C /path/to/file | head -D where A,B,C and D can be computed from the number of lines in the file, X and Y. But there are two problems with this approach: You have to compute A,B,C and D. The commands could pipe to each other many more lines than I am interested in reading (e.g. if I am reading just a few lines in the middle (HowTos)