procmail
[Top] [All Lists]

Re: Trimming an extra header.

2003-03-28 11:03:13
On Fri, Mar 28, 2003 at 10:33:32AM -0500, John Ehrlinger wrote:
I'd like to setup procmail to remove the header that Groupwise
added so the message would act like it was sent directly to my unix
account. I don't need to change the To address, I just want to remove
the first header.

Easier than monkeying with sed for this is to use formail, which
comes with the procmail package.  It is ideal for removing (or,
in general, doing things with) headers.

Here is the closest I've
gotten.

:0: fhw

Note that a lockfile should not come before recipe flags.  Also, a
recipe whose action opens a nested brace set needs no lockfile,
and you are undoubtedly seeing errors in your logs from the `f' and
`h' flags; and, probably, the `w' flag is also meaningless here,
though I just woke up from a nap and am frankly too groggy to think
clearly about it.

*^From:(_dot_)*(_at_)ccf\(_dot_)org\>
{
  :0Afwh

You didn't want an `A' flag here, either.

  |sed -e '/^$/,$!b' -e '/./,$!d'

  :0
  Groupwise
}

This trimmed some of the header correctly (Got the addressing correct),
but still left an empty header and lost the subject and the first line
of the body out.


What is the name of the header you want to delete?  Is it guaranteed
unique?  Formail has different flags for deleting all, first, last,
etc., of a header or header-regex.  Try this:

        :0 fwh
        * ^From:(_dot_)*(_at_)ccf\(_dot_)org\>
        * ^Some-Header-Inserted-by-Groupwise:
        | formail -I"Some-Header-Inserted-by-Groupwise:"

        :0 A:
        Groupwise

-- 
dman

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