Skip to content

Instantly share code, notes, and snippets.

@62mkv
Last active April 14, 2017 06:21
Show Gist options
  • Save 62mkv/8f476e3a3477dddda563dbbbda3dc81f to your computer and use it in GitHub Desktop.
Save 62mkv/8f476e3a3477dddda563dbbbda3dc81f to your computer and use it in GitHub Desktop.
bash: sed: how to print X lines of a file starting with a line N
# show lines 1000-1010 in "filename" file
sed -n '{1000,+100p}' filename
# another option is more simplistic syntax:
sed -n 1000,+10p filename
# also display line numbers:
sed -n '1000,+10{p;=}' filename
# other useful one-liners are available here: http://sed.sourceforge.net/sed1line.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment