I really screwed up this one.
Mail coming into our internal network gets several relays before it gets
to a desktop. I wanted to catch the point from which each message entered
our site.
So I want only the Received header in which "by" is our gateway. Thus:
:0fhw
| (print "$LOGFILE: $(egrep '^Received.*by gw1.hughes-defense-comm.com via')")
Entrance
This worked, as far as the file "Entrance" is concerned.
BUT all messages since I put that in have no headers at all when the get
to the in-box. (Except for procmail's "From foo(_at_)bar") I know it has
something to do with stdout, but I'm not sure what to do. ('tee' ?)
This was really an intermediate step, to look at a lot of such headers to
see whether the format is consistent enough to use $MATCH for the IP
address of the last outside host.
The third step is to use that IP address as input to a program that will
return the complaint address (or other info) appropriate for that host.