"Stan" == Stan Ryckman <stanr(_at_)sunspot(_dot_)tiac(_dot_)net> writes:
At 02:26 AM 5/14/97 -0400, Burnt Norton wrote:
Burnt> Has anyone hacked `mailstat' to calculate and display the total
Burnt> number of messages received by procmail in a given logfile?
Stan> Why hack mailstat when a simple UNIX tool will do?
Because you don't want to remember the whole awk invocation by heart?
Of course, you can put it in a one-script, or an alias. Actually, I
modified mailstat to get to the same result. Feed this message to
patch to modify mailstat.
*** /usr/bin/mailstat Tue Apr 29 10:10:56 1997
--- /home/ggeens/bin/Mailstat Fri Feb 14 16:41:15 1997
***************
*** 17,23 ****
# Created by S.R. van den Berg, The Netherlands #
# This file can be freely copied for any use. #
#################################################################
! #$Id: mailstat,v 1.21 1995/03/20 14:51:08 berg Exp $
# This shell script expects the following programs to be in the
# PATH (paths given here are the standard locations, your mileage
--- 17,23 ----
# Created by S.R. van den Berg, The Netherlands #
# This file can be freely copied for any use. #
#################################################################
! #$Id: mailstat,v 1.20 1994/05/26 14:11:54 berg Exp $
# This shell script expects the following programs to be in the
# PATH (paths given here are the standard locations, your mileage
***************
*** 151,157 ****
TMPF=/tmp/maillog.$$
! trap "rm -f $TMPF; exit 2" 1 2 3 13 15
trap "rm -f $TMPF; exit 0" 0
########
--- 151,157 ----
TMPF=/tmp/maillog.$$
! trap "rm -f $TMPF; exit 2" 1 2 3 15
trap "rm -f $TMPF; exit 0" 0
########
***************
*** 163,168 ****
--- 163,169 ----
$cat >$TMPF <<HERE
BEGIN {
FS="\\t";
+ totalmsg=0;totalbytes=0;
}
{ if(folder!=\$1)
{ if(folder!="")
***************
*** 170,179 ****
--- 171,184 ----
messages=0;total=0;folder=\$1;
}
++messages;total+=\$2;
+ ++totalmsg;totalbytes+=\$2;
}
+ /#/ { --totalmsg; }
END {
if(folder!="")
printf($MSlong);
+ messages=totalmsg;total=totalbytes;folder="grand total";
+ printf($MSlong);
}
HERE
P.S.: From the comments in mailstat:
Customise to your heart's content, this file is only provided as a
guideline.
--
Guy Geens <ggeens(_at_)iname(_dot_)com>
Home Page: http://www.elis.rug.ac.be/~ggeens
finger ggeens(_at_)elis(_dot_)rug(_dot_)ac(_dot_)be for PGP public keys (or use
keyserver)