Skip to content

Instantly share code, notes, and snippets.

@tikolakin
Created November 18, 2015 08:36
Show Gist options
  • Save tikolakin/3218a43d8c2092e0f86c to your computer and use it in GitHub Desktop.
Save tikolakin/3218a43d8c2092e0f86c to your computer and use it in GitHub Desktop.
How to find patterns across multiple lines using grep?
#!/usr/bin/env bash
#If you are willing to use contexts, this could be achieved by typing
grep -A 500 abc test.txt | grep -B 500 efg
#This will display everything between "abc" and "efg", as long as they are within 500 lines of each other.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment