On Tue, Jan 11, 2005 at 03:01:38PM +0100, Fabian Braennstroem wrote:
:0hw
FROM=|formail -I "" | sed -n -e '/By\ /p' | sed -e
's/^\(.\{0\}\).\{3\}\(.*\)/\1\2/'| sed -e
's/^\(.\{10\}\).\{30\}\(.*\)/\1\2/'
| formail -i "From:$FROM"
Which should looks for the line with 'By ' and remove the
first 3 columns and the columns from 10. The 'sed' part works
fine, but 'formail' produces weird From-Headers like: '|'
and some did not change at all!?
I tested the 'sed' part separately, so this should not be
the error.
That's not a good use of sed. You are invokin sed three different times
sequentially. You should only ever have to invoke it once in a situation
like this. Worse, you are now simply extracting the entire header
with your formail pipe and then feeding the entire header to sed (thrice).
But (a) that is completely unnecessary; and (b) the h flag on the recipe
already is limiting the pipe to the entire header (but not the body).
Second, if formail there gives you funny chars, then the problem was your
sed instruction, yes.
Perhaps you are using a different shell in procmail than you are on the
command-line when you test by hand? Or a different sed binary? However,
I think it is because you probably tested on the From: header, but in
this recipe you are operating sed on the entire header, not just From:.
--
dman
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail