Anyone else sick of this?
Subject: a topic we have talked about -Reply
rather than
Subject: Re: a topic we have talked about
How do I get rid of the -Reply and _pre_pend a "Re:" _unless_ one is already
there?
SUBJECT=`formail -zxSubject:`
:0
* ^Subject:.*\-Reply$
{
NEWSUB=`echo "$SUBJECT" | sed 's/\-Reply$//g'`
# does the RE have to be specified upper and lowercase?
:0fhw
* ^Subject: Re:
|formail -i"Subject: $NEWSUB"
# do this only if we did not do the previous
:0Efhw
|formail -i"Subject: Re: $NEWSUB"
}
That looks right to me, except that if there is a Subject line like this:
Subject: Some really long reply -Reply -Reply
it will only get the last one... is there a way to call the recipe
recursively to get rid of them all?
For example, if I save the above recipe (the part in the {} marks) into a
file called ~/.procmail/fix-reply.rc
:0
* ^Subject:.*\-Reply$
{ INCLUDERC=$HOME/.procmail/fix-reply.rc }
and made the text of 'fix-reply.rc' this
# Begin
NEWSUB=`echo "$SUBJECT" | sed 's/\-Reply$//g'`
# does the RE have to be specified upper and lowercase?
:0fhw
* ^Subject: Re:
|formail -i"Subject: $NEWSUB"
# do this only if we did not do the previous
:0Efhw
|formail -i"Subject: Re: $NEWSUB"
:0
* ^Subject:.*\-Reply$
{ INCLUDERC=$HOME/.procmail/fix-reply.rc }
# end
Does that seem to be right? I'd hate to recursively call an rc-file without
being sure.
TjL