I have a mail log file and I want to extract some lines belonging to one domain. For example
Input File:
Dec 12 03:15:28 postfix/smtpd[550]: 3F481EB0295: client=unknown[x.x.x.x], sasl_method=PLAIN, sasl_username=abcd@xyz.com
Dec 12 03:22:08 postfix/smtpd[1428]: 60B56EE001D: client=5ad9b9ba.com[x.x.x.x], sasl_method=LOGIN, sasl_username=efgh@abc.com
Dec 12 postfix/smtpd[1428]: 4314FEE0019: client=5ad9b9ba.bb.com[x.x.x.x], sasl_method=LOGIN, sasl_username=xyz@xyz.com
and so on
I want to extract those lines which contains sasl_username=anything@xyz.com. There can be 1000 lines which contains @xyz.com, I want all the lines. Before @xyz.com it can be anything. Hope I am clear.
I am trying with grep and awk commands but could not able to do so. Please suggect any idea
I want whole line which contains "sasl_username=name@xyz.com". Where name can be anything ie any name on the planet. And I think the above command is doing that thing. What do you say?