Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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.

Thoughts?

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
1  
@UtahJarhead: See update :) – choroba Oct 7 '12 at 22:38
    
nevermind, that was your edit. ;) – UtahJarhead Oct 7 '12 at 22:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .