Alternatives for 'egrep -o "success|error|fail" <filename> | sort | uniq -c'

Posted by Wolfy on Ask Ubuntu See other posts from Ask Ubuntu or by Wolfy
Published on 2012-09-17T06:43:59Z Indexed on 2012/09/17 9:51 UTC
Read the original article Hit count: 330

Filed under:
|
|
|

I sometime need to check some logs and I do this with this command:

egrep -o "success|error|fail" <filename> | sort | uniq -c

Sample input:

test error on line 10
test connect success
test insert success
test started at 00:00
test delete  fail

Sample output:

1 error
1 fail
2 success

I would like to know if someone knows a way to do this with a shorter command?

Before you ask why I would like to do this with an different command... No special reason, I'm just curious :)

© Ask Ubuntu or respective owner

Related posts about command-line

Related posts about command