[wellylug] Parsing Mail log files

Jamie Dobbs jamie.dobbs at orcon.net.nz
Fri Oct 28 14:39:12 NZDT 2005


I am trying to parse my mail log files to find out the number of messages
received per day and the total size of the messages received.

The format of the log files is:

>From xxxxx  Fri Oct 28 14:25:12 2005
 Subject: FW: Emailing: super_cop_1_.wmv
  Folder: ~/Maildir/new/1130462726.5627_0.xxx                 2442024

Getting the number of messages per day is pretty easy, and I have done in
this way"

for f in ~/Maildir/log*; do echo "$f :" `grep "Folder:" "$f" | wc -l`; done

I would also like to be able to get the total bytes/kbytes of the messages
received for the day and although I can see how it should be done
logically I do not know how to translate this into a command for a shell
script like the above. Logic tells me that we want the last "word" of the
line starting with the word "Folder:" and keep a running total of this.
Can anyone advise how I can do this?

Cheers

Jamie






More information about the wellylug mailing list