On Saturday, Jan 18, 2003, at 08:58 Canada/Mountain, dman(_at_)nomotek(_dot_)com
wrote:
Yes, I know, this is not the right way. [. . .]
Bit of an undertstatement, yeah. :-)
<snip>
4:42pm [~/Mail] 590[0]> harness goodmail | grep MYF | distrib
23 procmail: Assigning "MYFOLDER=Chat-l.15-Jan-2003"
20 procmail: Assigning "MYFOLDER=Chat-l.16-Jan-2003"
20 procmail: Assigning "MYFOLDER=Chat-l.17-Jan-2003"
4 procmail: Assigning "MYFOLDER=Chat-l.18-Jan-2003"
1 procmail: Assigning "MYFOLDER=Chat-l.n-2003-03:4"
1 procmail: Assigning "MYFOLDER=Chat-l.n-2003-18:2"
1 procmail: Assigning "MYFOLDER=Chat-l.n-2003-19:2"
Interesting, I ran it on over 13,000 messages and didn't get a single
one that wasn't either "n mmm yyyy" or "nn mmm yyyy."
So we have three bogus outliers in the "good" mail. What will happen
if I run this on spam? I don't even want to know. :-)
Still, point taken
But we don't need echo, sed, or even date, anyway.
First off, you'd almost certainly want to use the From_
header to grab this info rather than the Date: one.
Maybe in general, but I thought it would be easier to grab it from
Date: (especially since i know I am dealing with GOOD mail here and I
did check the headers before I stared). Also, the From_ indicates when
the mail arrived at my local machine. If my connection is down that
can vary by 6-12 hours (and once, three days). I'd actually rather
have the Date: in this case.
Yes, I know this can be a problem we dealing with general incoming
mail, and I'm not planning on sorting my incoming mail based on the
date headers (I sort it based on `date`. this was basically a one shot
deal where I wanted to reprocess a specific mailing list into daily
folders.
Here's some stuff from my genvars INCLUDERC that will get
you what you need (and more).
MMtable = "{ Jan:01 Feb:02 Mar:03 Apr:04 May:05 Jun:06
Jul:07 Aug:08 Sep:09 Oct:10 Nov:11 Dec:12 }"
:0 # 030110 () save tail-end of FROM_ in order to parse DATE
* $ ^^From .* \/$AWEEKDAY .+
Oh, that's clever! wouldn't it make more sense to do:
* $ ^^From .* $AWEEKDAY\/ .+
though? do you WANT the weekday to be part of $MATCH?
{ FROM_ = $MATCH
:0 # 021211 () find year in FROM_
* FROM_ ?? ()\/....^^
Mightn't that match "-0600" if the date is in "Thu May 2 09:45:18 2002
-0600" format? (oh, wait, never mind. That would be seen as a 5
character word, right?)
:0 # 021211 () find MM
* $ MMtable ?? ()\<$MONTH:\/[01][0-9]
I don't understand that syntax.
:0 E # 021211 () replace space as necessary
{ DD = 0$MATCH }
Or that.
:0 # 021230 () find next year (four digits; let's not worry about
Y3K prob!)
Not Y3K compliant? Wuss! :)
--
...in the long run there's still time to change the road you're on
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail