procmail
[Top] [All Lists]

Re: Subject replacement

1998-05-08 05:12:40
On Thu, May 07, 1998 at 10:44:58PM -0700, David Hunt wrote:
If you ask for the _best_ way to do something simple, you'll get at least
a dozen replies, and start a two-week thread! Weell, I'll offer two ways.
None claim to be 'best'.

Oh.  Ummmmm...perhaps I should have asked for easiest?  Or perhaps the least
system intensive one?  <grin>  Yes, the subject allways follows the pattern of 
Subject: Trafficview Report: Estimated freeway driving time is **.* minutes.
What are the reasons for using formail versus sed (or even awk)? 

(and yes, Era, I did man formail, just couldn't pick out the best way to do 
it...and I only get these messages once a day, so I didn't want to mess them up)
Anyways, the way I read it, using formail -I removed the Subject field...does
adding the "Subject: foo" then replace the Subject field that was replaced?

If the subject line always follows a predictable pattern, then you use
some regexp to pick out the portion you want and rewrite the subject line
with formail. For example: 

    :0 fhw # "fhw" means filter the header and wait for the program to exit.
    * ^Subject: Trafficview Report: Estimated freeway driving time is \
    ()\/[.0-9]+.*
    | formail -I"Subject: Drive Time: $MATCH"

Yeah, I'm going to try one like this (thanks era)...
        :0fhw
        * ^Subject: Trafficview Report: Estimated freeway driving time is \/.*
        | formail -I "Subject: Drive Time: $MATCH"

Oh, David-- Thanks for the explanations of the recipes...that was probably the
best part...I could kind of understand the recipes themselves, but with your
comments after them, they were _clear_.  

Thanks,

Bryan
-- 
+----------------------------+--------------------------+
|       Bryan Albright       |     bryana(_at_)uswest(_dot_)net    |
+----------------------------+--------------------------+
| "Luke... Luke... Use the MOUSE, Luke" - Obi Wan Gates |
+-------------------------------------------------------+

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