procmail
[Top] [All Lists]

Re: Converting mmm to mm

2004-02-04 14:13:24
LuKreme wrote:

I have a recipe that gets the date from a messages' received header and
then sorts it into a mailbox based on the month and year.  trouble is,
the date in the received header is

(J(an|u[ln])|Feb|Ma[ry]|A(pr|ug)|Sep|Oct|Nov|Dec)

and I want the folder to be:

2003-05 instead of 2003-May

I could do this with a shell script, but I want the recipe to stand
alone and not rely on anything external that may or may not be there.

a sed substitution is an idea, but I can't think how to do that in
procmail without going through 12 iterations.

If you were new to this list, I'd simply post the answer, but for someone of your vintage here, Kreem, that question deserves a loud,

 Oh, honestly!

Presumably you've extracted $MONTHABB and $YEAR already.  Then

MONTHSTRING="Jan01Feb02Mar03Apr04May05Jun06Jul07Aug08Sep09Oct10Nov11Dec12"

:0
* $ MONTHSTRING ?? $MONTHABB\/..
{ YEARANDMONTH=$YEAR-$MATCH }



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>