Unix - All about grep and log files

Finding relevant word and excluding irrelevant word

grep xception logfile.txt | grep -v ERROR

If you are looking to count a particular word in log file

grep -c "Error" logfile.txt

Getting multiple lines around matched text

grep --context=6 xception logfile.txt
grep -C 2 'hello' *

Finding any of the multiple texts strings in log file

egrep 'Error|Exception|Debug' logfile.txt

Finding within .gz (zipped) file without unzipping them

zgrep -i Error *.gz

Display the file names that matches the given pattern

grep -l ERROR *.log

Related Posts

Effective use of Tail / Find / Grep / Sed / Awk with Application logs
Unix Shell Scripts for Log Monitoring , Production and Application Support 
Best Practices for Application Support on Unix / Linux