procmail
[Top] [All Lists]

Re: Removing a single "Received:" header

2001-09-19 21:13:19
Brian asked,

| I would like to remove a single "Received:" header that contains 2
| strings.  I don't want to toss out the other "Received:" headers, only
| the one the matches the 2 strings.  Renaming the matching "Received:"
| header to "old-Received:" would be even better.  And then after all of
| that is done, I want the rest of my recipes to continue processing the
| message.

I gather that there is no way to tell where among the Received: headers that
particular one will appear: topmost (latest), bottommost (earliest), or
anywhere in between.  Also, I'm not sure whether you're looking for one that
includes *either* of the two strings or *both* of the two strings (and your
sample code didn't clear that question up positively either).

My only advice is to filter the entire head through

 formail -c | grep -v pattern # or egrep if you need to search for either
                              # string instead of both
or
 formail -c | sed 's/^Received:.*pattern/Old-&/' # if you want to prepend
                               # Old- à la formail -i instead of deleting

Either way, you'll lose the breaks in any continued header lines.

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