procmail
[Top] [All Lists]

using MATCH for getting folder destination names

1996-12-16 02:56:22
I'm running procmail on my linux box, and it does a great job.  (No,
it does a *fantastic* job! :)  I'm subscribed to several linux email
lists and use procmail to put these messages into mh folders which
have names based on the name of the respective list.  (I've found
mh to be a very good mailreading package).

For example, `linux-net' goes into ~/Mail/net/., `linux-admin' goes into
~/Mail/admin/. and so on.

At the moment I have separate delivering recipes for each list, for
example:

 # linux-admin
 :0H:
 * (^From[^:]|^Cc:|^To:).*linux-(admin|dev-admin)
 admin/.
 #
 # linux-net
 :0H:
 * (^From[^:]|^Cc:|^To:).*linux-(net|dev-net)
 net/.
 #
 # linux-ppp
 :0H:
 * (^From[^:]|^Cc:|^To:).*linux-(ppp|dev-ppp)
 ppp/.
 #
 # linux-svgalib
 :0H:
 * (^From[^:]|^Cc:|^To:).*linux-(svgalib|dev-svgalib)
 svgalib/.

and so on.

However, after thinking about this, I realised that all these recipes
are very similar and that using the `MATCH' variable might make it
possible for me to greatly simplify things so that *one* recipe is
used for delivering messages from each of these lists!

Something along the lines of:

:0
* (^From[^:]|^Cc:|^To:).*linux-.*(-|@)
$MATCH/.

My question is if this is possible.  I'm sure it is, but how?

I'm not sure exactly how the word in $MATCH is obtained, how
to make sure that what I get is exactly what I want (I could change
the names of some of my folders to make a match), and if this would
be a "foolproof" method of doing what I want.

In the above example matching rule, I have `*linux-.*(-|@)' so the the
next word after `linux-' and before the next `-' and `@' characters is
matched.  But what I have there now won't work as it is, since
anything _before_ `linux-' is also matched.

Or is it?  I'm confused :)

The names of the linux lists I'm subscribed to include:

linux-alert     linux-announce linux-ggi linux-security linux-kernel
linux-admin     linux-smp      linux-pro linux-admin    linux-x11
linux-standards linux-serial   linux-ftp linux-apps     linux-sound
linux-config    linux-console  linux-gcc linux-net      linux-ppp
linux-svgalib   linux-tape     linux-c-programming

In addition, matches need to be made on strings that look like
`owner-linux-(list)', `(list)-linux-digest', or
`submit-linux-dev-(list)@', etc.

A further complication is that I get at least two of these lists
(linux-admin and linux-kernel) as digests, and I then have recipes
that use procmail/formail to explode these for me into separate
messages.

Any suggestions for some nifty recipes to do this are most welcome, as
it would shrink my ~/.procmailrc by at least 75% and make reading and
maintaining it a whole lot easier!

Hehehe... in days BP - Before Procmail - the mere idea of subscribing
to so many lists (and these are only the linux-related ones) would
have been an exercise in chaos and progressive insanity!  I therefore
sing my praises about procmail for allowing me to "go nuts" on email
lists and still maintain perfect sanity :-)))

Cheers                               .
Tony                             _--_|\
    tony(_at_)trishul(_dot_)sci(_dot_)gu(_dot_)edu(_dot_)au  /     *\ 
T(_dot_)Nugent(_at_)sct(_dot_)gu(_dot_)edu(_dot_)au
    
ae(_dot_)nugent(_at_)student(_dot_)qut(_dot_)edu(_dot_)au\_(_dot_)--(_dot_)_/  
tnugent(_at_)cit(_dot_)gu(_dot_)edu(_dot_)au
    tony(_at_)sctnugen(_dot_)ppp(_dot_)gu(_dot_)edu(_dot_)au       v  Brisbane 
Qld Australia
   -=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-
begin 600 sig.secret
B2&5H92`Z*2!A(&QI='1L92!C=7)I;W5S(&%R92!Y;W4_"O^_
`
end

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