Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mail stats 1

Status
Not open for further replies.

normntwrk

MIS
Aug 12, 2002
336
US
I need to send a list every day of stats to my manager of emails from a certain company. He wants to know who the email was from and what the subject was. I can't figure out how to match the subject with the sender as it is on the next line in the procmail log

procmail: Acquiring kernel-lock
procmail: Unlocking "/var/spool/mail/denisew.lock"
procmail: Notified comsat: "denisew@1048263:/var/spool/mail/denisew"
From aughonK@xxxusa.com Thu Feb 17 05:57:04 2011
Subject: Auto start on ATL looks good ... THANKS >>>
Folder: /var/spool/mail/denisew 8670
procmail: [8293] Thu Feb 17 05:58:07 2011
procmail: Assigning "LOGABSTRACT=all"
procmail: Assigning "PATH=/usr/bin:/bin:/usr/bin:/usr/local/bin:/usr/bin/X11"
procmail: Assigning "SHELL=/bin/sh"
procmail: Executing "formail,-x,To:"
 
A quick hack:
Code:
egrep "(From|Subject|Folder)" mail.log | sed 's/.*Folder.*/#/' | tr -d '\n' | tr '#' '\n'

Filter for 'From', 'Subject' and a delimiting line between Subject and next From. I took 'Folder' - take something which is always there.

Substitute the 'Folder'-line with some funky character, which will probably not occur in the From or Subject line.

Use tr (translate) to -d(elete) end of line. Now translate the separator # back to EOL.



don't visit my homepage:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top