Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to export lines 100 to 1,000,100 from a file with 62 million lines. So far I've found this command:

head -1100000 input > output

But head does not take an offset option.


share|improve this question
up vote 6 down vote accepted

Combine head with tail:

tail -n+100 input | head -n1000000 > output

You can also use sed:

sed -n '100,1000100p' input > output
share|improve this answer
That's the one that came to mind for me as well, but there's probably a way to do it with a single 'sed' command. – UtahJarhead Oct 7 '12 at 22:37
@UtahJarhead: See update :) – choroba Oct 7 '12 at 22:38
nevermind, that was your edit. ;) – UtahJarhead Oct 7 '12 at 22:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.