Adam Shostack writes:
At work, we have a bunch of mailing lists which insert [Listname] into
the subject line, which annoys me, and breaks mutt threading. So, I
want to remove the [Listname] portion.
I'm currently using a two phase rule, where first the subject is
passed to sed for reduction, and then the new subject is passed to
formail. I'm having a lot of trouble getting the quoting right such
that $SUBJECT is set correctly when the mail is dumped into the right
folder.
(For extra guru points, it would be cool to have a single recipie that
manages all the lists that are done in this way.)
I'm currenly working with something like this:
:0
*^TOdevteam
{
:0
SUBJECT=|formail -x 'Subject:' |/bin/sed 's/ \[Devteam]//g'
^
missing \
Better (no sed, only one invocation of formail):
:0 hfw
* ^Subject:[ ]+\[Devteam\][ ]+\/.*
| formail -I"Subject: $MATCH"
Both bracket pairs enclose tab and space.
:0:devteam.lock
|formail -I "Subject: ${SUBJECT}" >> devteam
:0:devteam.lock
devteam
}