procmail
[Top] [All Lists]

automated archive filenames

1996-01-21 20:36:14
I've devised the following crucial part of my .procmailrc
as a way to eliminate a couple thousand bytes of clutter
in my rc and simplify houskeeping.


## FRIENDS
##
MAILDIR=$HOME/Mail/archive  # change directories

 # Following recipe stores each writer's files under his or
 # her respective email name before any "@" sign.

:0 wc  # c-flag replicates a copy for fall-through to my inbox
* ^From: \/(afob|alerman|andrys|brenner|brettf|carrollt| \
            cnorloff|dattier|davidg|elisa|fox|hartland|higa| \
            jamieson|jcook|jesse(_at_)spine|jgraf|jraphael|kael| \
            kenji|lbegeman|louie|ltw|luke|margery|miriam(_at_)spi| \
            mjsilva|mnementh|santra|seligman|southern|speacock| \
            schwim|teddybur|tgl|tittle|vidgames|zconcept|torin| \
            tsalagi|tweek|vjl|wb8foz)
* ! ^TO(cabal|infopro)
{
    ARCNAME=`echo "$MATCH" | sed 's/@.*//'`
    :0 w
    | gzip -fc >> "${ARCNAME}.gz"
}



This seems to work as desired.  But I'm convinced there would
be a better way to cut off the remainder of each emailer's
address than the sed kludge I devised.  Basically I don't
quite understand the syntax for MATCH, with all its variants.
(This was my first attempt at using some of the MATCH features.)

Any comments are appreciated. . . .
 
-- 
|) /\ |_ |_ |\/| /\ |\|  "I'm not a =real= programmer, but I play one on TV."

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