Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.