procmail
[Top] [All Lists]

Re: Procmail-recipe problem!

1998-02-24 01:23:07
On Mon, 23 Feb 1998 13:54:11 -0600 (CST), dattier(_at_)wwa(_dot_)com 
(David W. Tamkin) wrote:
When Era suggested this,
|  > 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

Well, what about leaving it in if it was there in the first place?

    :0fh
    | grep '^From[      ]'

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.

(This is still true, of course. But you can do something along the
lines of sed -e '1,/^$/{' -e '/^From[   ]/!d' -e} -e '/./,$!d' and
have the best of both worlds.)

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 ""

This is neat :-)

/* era */

Gack, Digital's sed is outrageously buggy.

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

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