procmail
[Top] [All Lists]

Re: Converting mmm to mm

2004-02-04 14:13:24
LuKreme writes:
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.
 
 Capture the date into a variable and use date from GNU shell utils.

$ date -d "Wed Feb  4 20:58:20 2004" '+%Y-%m'
2004-02
$ 


_______________________________________________
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>