|Wed 1998-12-30 Martin Schulze
<joey(_at_)finlandia(_dot_)Infodrom(_dot_)North(_dot_)DE> list.procmail
| > How do I set about archiving mail by date, either month or year?
|
| Try something like this:
|
| SUFFIX=`date +%Y%m`
|
| :0
| * ^X-Mailing-List: .*\/[a-z][^ ]*@
| {
| LIST=`expr match $MATCH '\(.*\)\@'`
|
| :0:
| $LIST.$SUFFIX
| }
Alternatively may I suggest using 20x faster and more general method that
use pure procmail means and no external binaries like `date' and `expr'.
PMSRC = <your-procmail-rc-code-dir-here>
RC_DATE = $PMSRC/pm-jadate.rc # name the subroutines
RC_LIST = $PMSRC/pm-jaliste.rc # Finds mailing list name
... somewhere at the top of .procmailrc ...
INCLUDERC = $RC_DATE # defines all date variables
TODAY = $YYYY-$MM # or $YYYY-$MM-$DD
INCLUDERC = $RC_LIST # Call mailing list detector
:0 :
* LIST ?? [a-z] # was the LIST name grabbed?
| list.$LIST.$TODAY # archive it
You can convert the mailing list name grabbed by RC_LIST wery conveniently
if you configure this variable: a) left; grabbed name b) right; wanted name
JA_LIST_CONVERSION = "\
jde java.jde,\
java java.prog,\
FLAMENCO flamenco,\
"
See more from pm-code.shar where all modules are included. You can get the
file by sending message "send pm-code.shar" to my address (See X-info field).
jari