using egrep to find missing @ in log

Posted by jols on Ask Ubuntu See other posts from Ask Ubuntu or by jols
Published on 2013-06-27T07:48:55Z Indexed on 2013/06/27 10:29 UTC
Read the original article Hit count: 348

Filed under:
|
|

I am using the following command to find log entries that are the result of a log in to the email server:

egrep '_login[^ ]' /var/log/exim_mainlog

That works fine to find entries that contain content like this:

P=esmtpa A=courier_login:[email protected] S=1573 id=f1cd08396,...

But what I need to do is to change my grep statement, so that it finds single word logins that do not use the @ sign, like so:

 P=esmtpa A=courier_login:name S=1573 id=f1cd08396,...

Where the log in before was "[email protected]", but in the second log entry, the log in used was only "name".

Is this possible using grep or egrep, perhaps in some kind of a compound statement?

Thanks much.

© Ask Ubuntu or respective owner

Related posts about command-line

Related posts about scripts