Skip to content

Instantly share code, notes, and snippets.

@virullius
Created December 3, 2014 18:23
Show Gist options
  • Save virullius/5b2c66983dc2665df7a8 to your computer and use it in GitHub Desktop.
Save virullius/5b2c66983dc2665df7a8 to your computer and use it in GitHub Desktop.
highlight matched text, linux shell
# trick is to match on a non-printing character (^ is beginning of line) OR your pattern.
# this way all lines match but only your pattern containing printable characters will be highlighted
# using ^ requires Extended-Regexp option (-E)
grep -E '^|pattern' file.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment