Skip to content

Instantly share code, notes, and snippets.

@ryannealmes
Last active August 29, 2015 14:23
Show Gist options
  • Save ryannealmes/4f6b5da6e327de2184bc to your computer and use it in GitHub Desktop.
Save ryannealmes/4f6b5da6e327de2184bc to your computer and use it in GitHub Desktop.
grep large files
B = before
A = after
grep -B [number of lines] -A [number of lines] [search string] [file]
If you want the same number of lines before and after you can use -C num.
grep -C [number of lines] [search string] [file]
Credit: http://stackoverflow.com/questions/9081/grep-a-file-but-show-several-surrounding-lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment