[Top] [All Lists]

Re: The received path

2001-08-19 11:41:03
KJ thanked me,

| Thank you for the information!

You'll be welcome as soon as I do something worth the thanks.  My last
message had a major goof in the sed code.

Originally I was thinking of piping to tr to change the newlines to spaces,
but then I decided to do that within sed by using the hold space.
Unfortunately I didn't adjust the sed instruction for yanking the addresses
out of the input to account for doing it once on the whole hold space
instead of one matching line at a time.

Let's fix that.  (If we wanted to make the sed code REALLY nasty we could
get rid of the first formail call as well, but just changing the newlines to
spaces is bad enough.)

 * ^Received:.*[     ]for[     ]+<.*>
 XRP=|formail -cxReceived: | sed -ne '/[     ]for[     ]<.*>/H' \
      -e '$ !d' \
      -e g \
      -e 's/[^\n]*[     ]for[     ][     ]*<\([^>][^>]*\)>[^\n]*/\1/' \
      -e 's/\n/ /gp'
#XRP=| formail -cxReceived: | \
#     sed -n 's/.*[     ]for[     ][     ]*<\([^>][^>]*\)>.*/\1/p' | \
#     tr \\12 \\40

 * XRP ?? [!-~]
 | formail -zA "X-Received-Path:$XRP"

procmail mailing list

<Prev in Thread] Current Thread [Next in Thread>