procmail
[Top] [All Lists]

using formail and sed to remove subject cruft

2001-08-12 19:05:15

Hi,

I've got a little regex issue here.  This is almost certainly a
silly regex mistake on my part, but no one who has looked at this
thus far has figured it out. :/

A little background first...  I filter mail from all the lists I
am subscribed to into individual folders.  I really dislike lists
that put [list-name] in the subject because it just waste
valuable space on the screen.  I worked up the following stuff a
couple months ago to filter most lists and remove the junk from
the subject.

:0
* ^(List-Id|X-Mailing-List): [^<]*<\/[^>]+>
{
    LIST=`echo $MATCH | sed -e 's/[(_dot_)(_at_)](_dot_)*$//'`

    :0 Wh
    SUBJECT=| formail -fxSubject:

    SUBJECT=`echo $SUBJECT | sed -e 's/\['$LIST'\][ ]*//i'`

    :0 fWh
    | formail -fI"Subject: $SUBJECT"

    :0
    * ? test -d $MAILDIR/l/$LIST || mkdir -p $MAILDIR/l/$LIST
    { }
    
    :0 w: l/$LIST/$LOCKEXT
    | $RCVSTORE +l/$LIST
}

There is obviously more to my procmailrc, but that is the part
that counts for this discussion.  Cleaning the subject seems to
work great on all the lists I am except one.  When the message
contains "Subject: [Mailman-Developers] this is an example" and
"List-Id: <mailman-developers.python.org>" the subject ends up
being (without fail) "Subject: l this is an example" instead of
what I want, "Subject: this is an example".

Any ideas?  Thanks.

- Doug
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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