Skip to content

Instantly share code, notes, and snippets.

@trigfa
Created April 27, 2016 16:27
Show Gist options
  • Save trigfa/3bece15821bf7f008e78f9eac062e229 to your computer and use it in GitHub Desktop.
Save trigfa/3bece15821bf7f008e78f9eac062e229 to your computer and use it in GitHub Desktop.
Searching for text in a file with context (2 lines before and after) and piping output to a file
grep -A 2 --after-context=2 --before-context=2 "Text we're searching for" input_file.txt >> output_file.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment