When Era suggested this,
| > | Or you could simply ditch the real headers and by happy coincidence
| > | have the auxiliary headers "promoted" to be the new headers of the
| > | message:
| > | :0fhi
| > | | /bin/true # just discard original headers
I had a couple concerns, such as this one:
| > Two potential problems: first, I'm not sure that procmail won't put a blank
| > line at the top when it glues the new (emptied-out) head back onto the
| > body;
to which Era answered,
| I tried it before I posted, but that's of course no guarantee that it
| will work in all situations.
Using /usr/bin/true worked for me too. Procmail did not leave a blank line
where the head had been. It probably works for most people. (Actually, I
should have known better, since filtering the head through formail -X ""
[*without* -k] removes the neck.)
Also, I wondered,
| > second, won't something need to regenerate the From_ line for most users?
but the way I suggested doing it wouldn't produce one; if you need one, you
have to use formail.
So we have these choices:
(a)
:0hfi
| true
:0fhw # `h' now refers to second set of headers, which were in body before
| formail
or (b)
:0fw
| sed '1,/^$/d;/./,$ !d' | formail
but note that (a) will fail if there are any additional blank lines at the
top of the body before the second set of headers.
Finally, here's a way to make headers from the beginning of the body super-
sede those in the head while retaining the rest of the head:
:0Bfhw
* ^^([^ ]+:.*$([ ].*$)*)+$
| formail -X ""
:0fhw # `h' now includes lines that were in the body before
| formail -U ""