How to display certain lines from a text file in Linux?

Posted by Boaz on Server Fault See other posts from Server Fault or by Boaz
Published on 2010-04-19T08:53:25Z Indexed on 2010/04/19 9:03 UTC
Read the original article Hit count: 318

Filed under:
|
|

Hi,

I guess everyone knows the useful Linux cmd line utilities head and tail. Head allows you to print the first X lines of a file, tail does the same but prints the end of the file. What is a good command to print the middle of a file? something like middle --start 10000000 --count 20 (print the 10,000,000th till th 10,000,010th lines).

I'm looking for something that will deal with large files efficiently. I tried tail -n 10000000 | head 10 and it's horrifically slow.

Thanks, Boaz

© Server Fault or respective owner

Related posts about linux

Related posts about command-line