procmail
[Top] [All Lists]

Re: original date

2001-08-29 08:44:45
At 03:07 AM 8/29/2001, Philip Guenther wrote:
[snip]
Here's an awk solution:
        :0 fhw
        | awk '/^Received:/ && ! seen { \
                   seen = 1; getline; while (/^[ \t]/) getline; \
               } \
               { print }'

A couple of minor nits.  First, procmail is supposed to fold the
header, so the "while" loop, though harmless, isn't needed.  Second,
the "Received:" could technically be any mix of upper or lower
case.  I would use:
        | gawk 'BEGIN{IGNORECASE=1} /^Received:/ && ! seen { \
                   seen = 1; getline; \
               } \
               { print }'
(gawk, GNU's awk, is faster than most system-provided awks, and supports
IGNORECASE), but if gawk is unavailable and the available awk doesn't
support IGNORECASE, then I'd go to:
        | awk '/^[Rr][eE][cC][eE][iI][vV][eE][dD]:/ && ! seen { \
etc.
just to be safe.

The same considerations would apply to the perl solution, but since
I'm not nearly as familiar with perl as with awk, I'll leave that
as an exercise for the reader  :-)

Cheers,
Stan

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