0

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?

1 Answer 1

6

Combine head with tail:

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

You can also use sed:

sed -n '100,1000100p' input > output
3
  • 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. Oct 7, 2012 at 22:37
  • 1
    @UtahJarhead: See update :)
    – choroba
    Oct 7, 2012 at 22:38
  • nevermind, that was your edit. ;) Oct 7, 2012 at 22:38

You must log in to answer this question.

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