procmail
[Top] [All Lists]

Re: Would someone please explain the f-flag?

1996-03-26 20:53:36
David Dyer-Bennet <ddb(_at_)gw(_dot_)ddb(_dot_)com> writes:
Good explanation.  You know, I only figured out that procmail held
header and body separately, and you could replace either piece
independently, multiple times, by studying SmartList. It's a rather
elegant design.  

You do need to watch yourself when replacing the header though, as
procmail recalculates where the header/body break occurs each time you
filter the header (with or without body).  It counts the empty line
that separates them to be part of the header, so if you say:

:0 hf
|sed '/^$/d'

Then it will join everything in the body up to an empty line as being
in the header.  Alternatively, if you say:

:0 hf
|sed 's/^Subject:.*//'

Then it will take everything after the now nonexistent Subject: line
and count it as being in the body.  This is the correct behavior in my
book, but it does mean that you may have to keep the above in mind when
crafting complicated header filters.  Don't go and gratuitously delete
empty lines in the header, nor should you use blank lines as markers in
partially processed headers unless you're totally sure you know what
you're doing.  Neither of those actions seem likely, but I'd just keep
my eyes open.  You never know...

Philip Guenther

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