Last active
September 20, 2019 12:57
-
-
Save joellobo/c6f8069c21733f407574ce9cf6ae4afc to your computer and use it in GitHub Desktop.
Linux - grep
This file contains hidden or 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
systemd-analyze blame | |
1. Grep OR Using \| | |
grep 'pattern1\|pattern2' filename | |
2. Grep OR Using -E | |
grep -E 'pattern1|pattern2' filename | |
3. Grep OR Using egrep | |
egrep 'pattern1|pattern2' filename | |
4. Grep OR Using grep -e | |
grep -e pattern1 -e pattern2 filename | |
5. Grep AND using -E ‘pattern1.*pattern2’ | |
grep -E 'pattern1.*pattern2' filename | |
grep -E 'pattern1.*pattern2|pattern2.*pattern1' filename | |
6. Grep AND using Multiple grep command | |
grep -E 'pattern1' filename | grep -E 'pattern2' | |
7. Grep NOT using grep -v | |
grep -v 'pattern1' filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment