procmail
[Top] [All Lists]

Re: stripping MATCH's right hand side

2001-12-07 12:35:51

On Fri, Dec 07, 2001 at 06:21:02PM +0000, Martin McCarthy wrote:

Personally, I'd probably use sed.  Perhaps something like:

        :0:
        * 
^List-Unsubscribe:.*leave-isp-\/(_dot_)*(_at_)(_dot_)*isp-lists(_dot_)com
        * MATCH ?? ^\/[^(_at_)]+
      {
          NAME=`echo "$MATCH" | sed 's/-[^-]\+$//'`

          :0:
          ISP-$NAME
      }

Is it possible to use a backquote expansion as part of the action
itself?  What about something like:

        :0
        * 
^List-Unsubscribe:.*leave-isp-\/(_dot_)*(_at_)(_dot_)*isp-lists(_dot_)com
        isp-`echo "$MATCH" | sed -E 's/-[^-]+(_at_)(_dot_)*$//'`

to avoid bothering with the variable assignment?  Is there any risk
involved with leaving out the process of definine a variable?  (And yes,
David, I know that sed -E doesn't work in all operating systems. ;> )

I can't think of a pure procmail solution off the top of my head.

Why is the floor suddenly so cold?  Is hell feezing over?!?


-- 
  Paul Chvostek                                             
<paul(_at_)it(_dot_)ca>
  Operations / Development / Abuse / Whatever       vox: +1 416 598-0000
  IT Canada                                            http://www.it.ca/

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