At 15:03 2009-02-19 +0000, o(_dot_)nash(_at_)cs(_dot_)ucc(_dot_)ie wrote:
I want to filter message based on Dete: header so that
in any month:
days 1-7 go in one file
days 8-15 go in another etc ...
You've got some odd math there - your second group is more than 7
days. What are we supposed to figure the third group will be?
Surely, you really intend to have:
Otherwise, please be more specific.
This egrep expression does the trick but does not translate to procmail.
egrep ^Date:.*\ \(1\|2\|3\|4\|5\|6\|7\)\ $MNTH\ $YR sent-mail
Without resorting to separatwe rules like:-
However, you'll either need a clever series of rules to extract info, or at
least a batch of rules to operate on a series of dates (just as your egrep
* $ ^Date:\ .*\ 1\ $MNTH\ $YR
The following is UNTESTED.
There's no reason to escape spaces, as they posess no special regexp
meaning (whereas .?* and others do).
Dates on _received_ emails are suspect - many don't follow proper
format. Since you're using this on SENT mail, just ensure
your MUA is producing valid Date: headers.
I maintained the 'c'opy flag on the recipe, but have no idea why you
were using it (even in the context of your multi-check
series). It is only valid if there are other recipes that
follow the current one that need to operate on a copy of the
You could use basically the same method to extract the month and
year from the date - then formail is simply bursting the
multiple-message file into individual messages for procmail.
* $ ^Date:[ ]*\/[0-9]+ $MNTH $YR
* MATCH ?? \/[0-9]+
# now, MATCH should contain just the day of month.
# File away with abandon.
* MATCH ?? ^^(1|2|3|4|5|6|7)^^
* MATCH ?? ^^(8|9|10|11|12|13|14)^^
# the remaining recipes are left as an exercise for the reader.
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
procmail mailing list Procmail homepage: http://www.procmail.org/