procmail
[Top] [All Lists]

script with sed

2000-10-02 19:02:34

A suggestion I liked concerning my script was to
use sed to change the subject line, specifically

:0fhw
    * ^TO_gatekeeper\+[0-9]+@
    * ^Subject: *re:.*@
    * Any.other.conditions.you.need??
    | sed -e '/^Subject:/s/\*-.*$//'

I think I understand what sed is used for, and that
it uses regular expressions like procmail (??)

I don't think i have this line down 100%, here in my
own code is what I think it happening:

The subject line in the header is
"Subject: Re: MailWeb: Test A +-bozo(_at_)bozo(_dot_)com"

:0fwic
* ^Subject:[  ]+\/.*
   | ( sed -e '/^Subject:/s/\*-.*$//' ; \
   formail -rkb -I "From: $REALSENDER" -I "To: $ORIGINATOR"  \
   -I "Return-Path:$REALSENDER" -I "Sender:$REALSENDER" \ 
    -I "Reply-To: $REALSENDER") \
   | $SENDMAIL -oi $ORIGINATOR


The recipe :0 
f  consider the pipe as a filter
w tells Procmail to hang around and wait for the script to
     finish.
c  operate on a copy (a copy of every email is saved in a dir)
i  ignore write errors

sed -e '/^Subject:/s/\*-.*$//'

dont need the -e option?
/^Subject:/   match this
s  sed substitution flag
/\  extract
substitute anything starting with "*-" followed by
anything any number of times up to the end of the line
with // or with nothing.   Seems right to me.

You enter the recipe, change the subject line, do formail
then do sendmail.  The above corrupts my mailbox.  Is this
syntax better?

:0fwci
* ^Subject:[  ]+\/.*
   | sed -e '/^Subject:/s/\*-.*$//' ; \
   | (formail -rkb -I "From: $REALSENDER" -I "To: $ORIGINATOR"  \
   -I "Return-Path:$REALSENDER" -I "Sender:$REALSENDER" \ 
    -I "Reply-To: $REALSENDER") \
   | $SENDMAIL -oi $ORIGINATOR

Thanks   Tom

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