Using sed to extract line ranges from a text file

 
Published on 2014-03-13 by John Collins.

I often find myself working with very large text files, which are impractical to open in an editor. If you need to extract a line-range section from a file, you can use sed:

$ sed -n 100,200p really_big_file.log

...where 100 is the starting line, and 200 is the end.