On Sat, 23 Jun 2001, Philip Guenther wrote:
pg> "S.Toms" <smotrs(_at_)mindspring(_dot_)com> writes:
pg> ...
pg> > Anyway, I'm trying to come up with a recipe that will deal with all the
pg> >re's and fwd's that appear in the subject line
pg> >
<snipped previous>
pg>
pg>
pg> How about the following?
pg>
pg> # We only have to do something if there are at least two in the subject
pg> :0
pg> * ^Subject: *(Re|Fwd?): *\/(Re|Fwd?):.*
pg> {
pg> # Strip Re:, Fw: and Fwd: bits from the extracted text
pg> NEWSUB = "`echo $MATCH | \
pg> sed -e 's/[rR][eE]: *//g' \
pg> -e 's/[fF][wW]: *//g' \
pg> -e 's/[fF][wW][dD]: *//g'`"
pg>
pg> # Extract the leading bit and put the new subject in
pg> :0
pg> * ^Subject: *\/(Re|Fwd?): *
pg> | formail -I "Subject-New: $MATCH$NEWSUB"
pg> }
pg>
Besides the missing 'f' flag for extracing leading bit, appears to work
pretty good. Don't think I would have come up with this anytime soon.
Thanks a bunch :)
pg> Note that the above will remove Re: and the like from the _middle_ of
pg> the subject. Removing only leading ones requires more sed hackery than
pg> I know, or a switch to perl or awk.
pg>
pg>
pg> Philip Guenther
pg>
--
S.Toms - smotrs(_at_)mindspring(_dot_)com - www.mindspring.com/~smotrs
SuSE Linux v7.0+ - Kernel 2.2.18
Mandrell: "You know what I think?"
Doctor: "Ah, ah that's a catch question. With a brain your size you
don't think, right?"
-- Dr. Who
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail