Subject: Re: anyone know how to do this....

From: Bob Bagwill <[email-masked]>
Date: Mon, 20 Mar 95 09:29:22 -0500

On Sat, 18 Mar 1995 16:09:31 -0800  Brian P Theodore wrote:
>I would like a recipe which would allow the name of a file which
>filtered mail goes to include the current date.

Here is a recipe of mine.  If there's a better version of it,
I'd like to know.

:0
* ^From:.*RISKS Forum <[email-masked]>
# use braces to group to subrecipes
{
# copy message header
	:0hc
# pipe header to formail, extract subject line value, assign to
# environment variable
	SUBJECT=| formail -xSubject:
# translate to lowercase and change spaces to underscores and assign
# to environment variable
	FILENAME=`echo $SUBJECT | tr A-Z\  a-z_ | sed 's/digest_//'`

# extract body of message and save to file using variable
	:0b
	$HOME/$FILENAME
}

--
Bob Bagwill

---

From: [email-masked] (Michael Shields)
Date: Mon, 20 Mar 1995 15:59:25 -0500 (EST)

> filtered mail goes to include the current date.  For example, if
> you wanted mail from a high volume list-proc to be saved by the month,
> say in the form "some-list_2_95".  Therefore, when the date changes
> months, a new archive for that month gets created.

You could use date(1) to generate the folder name, thusly:

        SOMELIST=`date +some-list-%Y-%m`

which will set $SOMELIST to something like `some-list-1995-03'.
If your date(1) won't handle this, get GNU date from GNU sh-utils, on
prep.ai.mit.edu:/pub/gnu or your favorite mirror.

This will save it based on the date the mail is received, which has the
advantages of being (a) easy to implement, (b) fast to execute, and (c)
not having to worry about new mail arriving in old folders.  Alternative
behavior might be to file it based on the Date: header, but that's a
trickier problem because it requires something to parse and reformat it.
-- 
Shields.