The following are the most frequently used grep options and examples:
1. Grep lines that contain the word "error" in the logfile
2. Negation. Grep lines that do not contain the word "error" in the fileCode:grep error logiflename
3. count the number of error lines in log file.Code:grep -v error logfilename
4. case insensitive grepping. Matches both upper case, lower case patterns.Code:grep -c error logifle
5. Print only file names that contain the specified pattern.Code:grep -i error logifle
Code:grep -l error logfiles*
Bookmarks