Hi!
Thanks for the reply Era.
Please note comments below.
On Fri, 11 Dec 1998 17:00:22 +0200 (EET), era eriksson (aka "era"),
regarding 'Re: Help with filter recipe.', said:
era> On 11 Dec 1998 14:18:49 +0000, Nelson Jose dos Santos Ferreira
era> <Nelson(_dot_)Ferreira(_at_)inesc(_dot_)pt> wrote:
>> ------
>> #! /bin/sh
>> /bin/sed 's/[ ]*^K[ ]*/\
>> /g' | /bin/sed 's/[ ]*^K[ ]*/\
>> /g'
>> exit 0
>> -----
era> (Parenthetically:
era> #!/bin/sed -f
era> s/[ ]*^K[ ]*/\
era> /g
era> s/[ ]*^K[ ]*/\
era> /g
Never thought of that. I'll give it a try... Less overhead.
era> You can pass several commands to sed from the command line too, with
era> the -e option: sed -e 's/[ ]*^K[ ]*/\
era> /g' -e 's/[ ]*^K[ ]*/\
era> /g' ... It is not clear to me why you are doing the same substitution
era> twice, assume there's a typo there. Oh, wait, one is a literal ctrl-k
era> and the other is the string caret-k. Is that why?)
Yep. The literal caret-k is the reason.
era> sed is usually not very tolerant of control characters. Have you
era> verified that this works as intended from the command line, on the
era> host where Procmail runs?
Yes. I did that.
era> Also, I hope you are actually using real ctrl-K:s
era> in the script rather than the string caret-K. But
era> like I said, your sed might not be prepared to cope
era> with that; if not, investigate whether you can
era> accomplish what you want with Perl (simple
era> -- Perl basically understands sed s/// syntax, but
era> has a lot of regex
era> goodies and extensions, and of course a whole
era> language to go with it);
era> | perl -e 's/\s*\013\s*//g'
I did thought of that but I thought that calling sed would
make for less processing overhead. Does your experience tell
otherwise ?
era> or perhaps something involving
era> | tr '\013' '\012' # this will not kill whitespace around ^K, of
course
era> which you are of course free to elaborate on.
Now for the real problem....
>> I call it on my .procmailrc like this:
>> :0 fw
>> *$ ${FROM_LIST}(@|\<)pilotgear
>> | $HOME/bin/pilotgear.strip.k
>> :0:
>> *$ ${FROM_LIST}(@|\<)pilotgear
>> mail.pilot-gear
era> If this only appears in this one list, you can do both in one fell
era> swoop:
era> :0w:
era> * $ ${FROM_LIST}\<pilotgear
era> | strip-ctrl-ks >>mail.pilot-gear
I'll try this.
era> \< already covers @ so you don't need the alternation you had there.
Really ? I had some funny behaviour which was solved when I
added the alternation... Maybe I'm confused :)
era> Alternatively, perhaps you want to make sure you only filter the body;
era> in that case, your original two-recipe script is better, but you need
era> a b flag -- and perhaps you want to make sure the message actually
era> contains a ^K before you go and spawn off the filter:
era> :0bfw
era> * B ?? ^K
era> * $ ${FROM_LIST}\<pilotgear
era> | strip-ctrl-ks
era> # proceed as earlier ...
I'll try this before your previous suggestion.
era> Throughout this message, I have used the string caret-K where you
era> should have a literal ^K character (ASCII 11).
Does that include the condition on the
* B ?? ^K
line ???
>> still have Control-G in it, dispite the filter which I know
era> ^
era> (Perhaps this is the big problem? You talked about ctrl-K earlier. :-)
Control-G was a typo of mine :))
era> Hope this helps,
It did immensily.
Thanks
Nelson
[...]
---
Nelson Jose dos Santos Ferreira | . . . | INESC/PT-Servicos
Systems Integrator | |. / / . | Lisbon,PORTUGAL
mailto:Nelson(_dot_)Ferreira(_at_)inesc(_dot_)pt |.||\| | / | Phone:+351 (1)
3100050
| .|<:/ \. | Fax :+351 (1) 3100008