Linux command for finding a particular word and finding its number of occurrences for a particular date -


i have log files roll out every day.

i need find out, error occurrences particular day (20/3/2014)

i need find out no of occurrences of word error particular day or set of days in log files , print errors in separate file.

and mail should sent details of errors.

egrep can lookup such occurrences , store them in file. expression below ocurrence of token error , print line token found.

egrep -i "\s*error\s*" your_file > stored_errors_file 

you can redirect output of egrep file , count number of ocurrences with

wc -l stored_errors_file 

i hope helps


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -