I want to parse my /var/log/maillog to print out the email addresses in "from=<>" and "to=<>" (mainly to do a quick check for false positives in the DNS RBLs that I've configured)
A maillog entry looks like this (postfix):
Jun 20 17:27:52 foobarserver postfix/smtpd: NOQUEUE: reject: RCPT from sbr.nouveauquebec.com[22.214.171.124]: 554 5.7.1 Service unavailable; Sender address [firstname.lastname@example.org] blocked using urired.spameatingmonkey.net; Red listed, see http://spameatingmonkey.com/lookup/nouveauquebec.com; from=<email@example.com> to=<firstname.lastname@example.org> proto=ESMTP helo=<sbr.nouveauquebec.com>
and my regex is
I'm storing the matches in back references \1 and \2 which I want to print out. What I want to do is pipe the output from
cat /var/log/maillog and apply the regex on each line and output the backreferences.
Is there a quick way to accomplish this?