The following are the most frequently used grep options and examples:

1. Grep lines that contain the word "error" in the logfile

Code:
grep error logiflename
2. Negation. Grep lines that do not contain the word "error" in the file

Code:
grep -v error logfilename
3. count the number of error lines in log file.

Code:
grep -c error logifle
4. case insensitive grepping. Matches both upper case, lower case patterns.

Code:
grep -i error logifle
5. Print only file names that contain the specified pattern.

Code:
grep -l error logfiles*