Skip to content

Instantly share code, notes, and snippets.

@blackknight36
Created April 6, 2016 14:44
Show Gist options
  • Save blackknight36/f06af5998197cf909b0120d74024438b to your computer and use it in GitHub Desktop.
Save blackknight36/f06af5998197cf909b0120d74024438b to your computer and use it in GitHub Desktop.
Useful grep examples
Remove blank lines and comments:
egrep -v "^#.*" <FILE> |grep "."
Grep OR statement:
grep 'pattern1\|pattern2' filename
Grep OR Using -E
grep -E 'pattern1|pattern2' filename
Inverse grep (show lines that do *not* match a pattern)
grep -v
Do not print file name:
grep -h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment