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

rest - Spring boot: Request method 'PUT' not supported -

php - Magento - Deleted Base url key -

symfony - imagine_filter() not generating the correct url in LiipImagineBundle -