Skip to content

Instantly share code, notes, and snippets.

@detj
Created August 27, 2016 13:23
Show Gist options
  • Select an option

  • Save detj/afacae33cca98d1beff829f1693dee70 to your computer and use it in GitHub Desktop.

Select an option

Save detj/afacae33cca98d1beff829f1693dee70 to your computer and use it in GitHub Desktop.
Grab bunch of lines before & after certain keyword
# grab 10 lines before & after the pattern
# make sure escape sequences are reained so it looks pretty (that's what the -r flag is for in less)
grep -B 10 -A 10 "error" file.log | less -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment