--max-count=number of matches before stopping search
--exclude=*.txt with -r option
Note: Lookahead and lookbehind are Perl-style regular expression elements, so you'd have to use Perl directly, or GNU grep with the -P option, which then interprets Perl regex.
grep -o pattern file.txt **shows only the matched string**
grep -bn pattern file.txt **shows row and col**
grep -v pattern file.txt **inversion**
grep -A 3 pattern file.txt **3+ lines after**
grep -B 3 pattern file.txt **3+ lines before**
grep -c pattern file.txt **count matches**
grep -l/L pattern *.txt **list of files that matches/doesn't**
grep -f patterns.txt file.txt **seach using patterns file**
grep "stuff\|more" demo.txt **OR**
grep -E "stuff|more" demo.txt **OR**
grep -w "of" table.txt **search only for the entire word**
grep -x "of" table.txt **search only for the entire line**
grep -r menu /boot **recursive**
grep '\\<kot\\>' kot.txt **word starts/end with kot**
grep -e '--pattern' test.txt **match exact pattern**
grep -r [-l, --binary-files=without-match] "test" ./ **without binary files** recursive search
grepc -E '(co)lor\1{2}' logs.txt
Using backrefence to match colorcoco
cat test.txt | grep --color=always -E 'GET\s/example/\?p=1'
or grep 'GET\s/example/?p=1'
gives: GET /example/?p=1
echo "\ab e\f \. " | grepc -Eo '\\.'
finds \a \f \.