grep [options] pattern [file]
cat [file] | grep [options] pattern
grep searches in the standard input.grep-iIgnores case while searching.
grep -i "pattern" file.txt
-vInverts the match, showing lines that do not contain the pattern.
Searches recursively in directories.
grep -r "pattern" directory/
-**w**Searches for whole words.
grep -w "pattern" file.txt
-EUses extended regular expressions.
grep -E "pattern|another" file.txt