procmail
[Top] [All Lists]

Re: Separate pipes for header and body?

1998-05-19 15:10:59
On Tue, May 19, 1998 at 12:21:17PM +0200, Dirk Laurie wrote:
Martin Schulze wrote:

On Tue, May 19, 1998 at 11:36:27AM +0200, Dirk Laurie wrote:
How does one write a recipe that does one thing to the mail header
and another to the body?

:0 fhw
|pipe-for-header

:0 fbw
| pipe-for-body

Thanks for the help, but it won't quite do what I need.  This solution
makes two separate recipes.  Perhaps I should state my actual problem
instead of trying to make it abstract.

If you want to mix up header and body I think you'll need to pipe
the whole thing into a script.  I might be mistaken.

:0 fw:
| pipe-for-header-and-body

pipe-for-header-and-body
#! /bin/sh

tmp=temp-file
cat - > $tmp

cat $tmp | sed '/^$/,$d' # This is the header
echo                     # This divides header from body
cat $tmp | sed '1,/^$/d' # And this is the body, voila

Now you can do what ever you like to.

Regards,

        Joey

-- 
  / Martin Schulze  *  joey(_at_)infodrom(_dot_)north(_dot_)de  *  26129 
Oldenburg /
 / A mathematician is a machine                                  /
/                           for converting coffee into theorems /