Created
April 6, 2016 14:44
-
-
Save blackknight36/f06af5998197cf909b0120d74024438b to your computer and use it in GitHub Desktop.
Useful grep examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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