procmail
[Top] [All Lists]

Re: Modifying subject

2001-02-20 11:27:31
Glen Solsberry asked:
| How can I modify the subject line of a message?  Say I am subscribed to
| two lists: Intermediate Perl and Intermediate Python, but they both use
| [Intermediate] as their subject start.  How can I change Intermediate to
| Intermediate Perl (assuming of course that there is a differentiating
| mark between the two)? 

The other responses seem to miss the fact that you want to modify the
part of the Subject: within the brackets. Or at least that's the way I
read it.

Something like (untested):

:0
* Condition(s) that identify perl list, probably including also...
* ^Subject:[    ]\[Intermediate]
{
   NSUBJ=`formail -x 'Subject:' |sed 's,\(\[Intermediate\)],\1 Perl],'`
   :0 fhw
   | formail -I "Subject: $NSUBJ"
}

and then the same thing where the two occurences of "Perl" are replaced
with "Python".

And as I write this TjL has beat me to it. This one is slightly
different, but accomplishes the same thing.  Also, if these is one
header common to both lists, that uniquely identifies each, you could
use it to simplify this into one recipe. Something like:

:0
* ^Someheader: \/(perl|python)
* other possible conditions
{
  [exactly as above, with exception noted below]
}

then replace the two recipes with one, and the hardcoded "Perl" and
"Python" strings with "$MATCH".

-- 
 /"\                                                 Don Hammond
 \ /     ASCII RIBBON CAMPAIGN
  X        AGAINST HTML MAIL,
 / \      AND NEWS TOO

_______________________________________________
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>