procmail
[Top] [All Lists]

Re: sending just the header to a file

2001-03-06 11:51:51
Joe Altman <ja(_at_)panix(_dot_)com> writes:
On Tue, Mar 06, 2001 at 09:13:42AM -0500, Eric Krichbaum wrote:
I've got a pretty good recipe for the flavors of the Snow 
White/haha(_at_)sexyfun(_dot_)net/hybris.gen virus but I'd like to log the 
header to a 
file instead of sending the whole email to the file.   Is there a simple 
way to dump just the header portion out?
...
You mean like this:

:0hc:${HOME}/.mailspool/Procmail.head.lock
| cat >> ${HOME}/headers.cut

Taken from Timo's page, question 6, at

http://www.uwasa.fi/~ts/info/proctips.html

That's an odd name for the lockfile.  Why not $HOME/headers.cut.$LOCKEXT?
Or even better let procmail choose the lockfile name based on the file
being appended to:

        :0 hc:
        | cat >> ${HOME}/headers.cut

However, since appending to a file is the result of a normal mailbox
delivery, that can be more efficiently written as simply:

        :0 hc:
        $HOME/headers.cut

That eliminates a cat and a shell process, plus the pipe and extra reads
and writes.

Now, if you want to overwrite the file with each new message, then the
cat command is a reasonable choice.  Timo, can you update your page to
show the simpler and faster form?


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