Hi all,
I did some searching in this forum but can't find anything that matches the issue I'm bumping heads with.
On a CentOS4/Postfix (and bash everywhere) mail gateway box I run a command periodically to purge the Postfix queue of messages "From:MAILER-
DAEMON".
This is the one line'r (courtesy of the Postfix list archives)
Code:
mailq | grep -v "^[^0-9A-Z]+" | grep MAILER-DAEMON | awk '{print $1}' | postsuper -d -
This generates output exactly as shown:
[many preceding lines of exactly the same format]
postsuper: E657736C82BD: removed
postsuper: E1CAD36C8074: removed
and finally, at the end of the output:
postsuper: Deleted: 127 messages
What I'm trying to figure out how to do is this.....
Grab the number of deleted messages, and append them to a file with a timestamp e.g. 20070830 07:32 - 127
so somewhere in the latter end of this would be >> cron_purges
Can anyone help me understand how to grab *just* the number, and hang a timestamp onto it as shown in the above example?
Regards & TIA!
Wally