From: Evelyn Pichler [mailto:[EMAIL PROTECTED]
> 
> Here is the script
> 
> I call it from crontab and pipe the output to a file right 
> before logrotate.

>From script file:
egrep 'courieresmtp:.*status: success' /var/log/maillog \
        | sed 's/^\(.*addr=<[^<>]*\),\([^<>]*>.*\)$/\1.\2/g' \
        | awk '{printf ("%s;%s;%s;\n", substr($4,6),
substr($2,7,length($2)-7), substr($3,7,length($3)-7));}' 'FS=,'

or a slightly less obfuscated version:
perl -ne 'if
(/courieresmtp.*?from=<([^>]*)>,addr=<([^>]*)>,size=(\d*),status: success/)
{print "$3;$1;$2;\n"}' /var/log/maillog

(note that the command should be all on one line)

Bowie


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to