grep
grep commands.
man grep
GREP GREP
Search any line that contains the word bird in filename.
grep "bird" access.log
On multiple files.
grep "bird" access0.log access1.log access2.log
Case-insensitive search.
grep -i "bIrD" access.log
Search with regex.
grep -E "rs=[4-5,0]{3}" access.log
Count match and output sum.
grep -c "rs=500" access.log
Print num lines after match.
grep -A 10 "ERROR" app.log
Print num lines before match.
grep -B 10 "ERROR" app.log
Invert match.
grep -v "rs=200" access.log
Start slaming them pipes ||
grep "pub-k3y-1234-osv" access.log | grep "customerinvoice" | grep "rs=500"
Last modified December 15, 2021: linux (ba38006)