(original author retained as recipient as per their request)
At 08:51 2001-11-23 -0700, SoloCDM wrote:
How can I make the following work in Linux with sed 3.02 and
procmail 3.21?
| sed 's+>\([a-z0-9/"'(]\)+> \1+I'
Instead of "this doesn't work" some indication of what it is you expect it
to do (as a guess, it looks like you're saying "insert a space between a
message quote marker and the text which follows it - I can think of easier
-- as well as more correct - ways to do that), as well as an example of
what you're handing it, would be useful. As I see it, your problem isn't
with procmail - it's a bad sed command.
Any single character found within the "[]" brackets must be kept and
they are preceded by the right arrow '>'. The only thing getting
added is a space.
Are the characters in the '[]' brackets based on the sed shell tags
or procmail's?
Suggestion: get the sed script working on it's own BEFORE trying to use it
from procmail. This would wholly remove procmail from the equation. Also,
it'd be slighly clearer if you didn't use alternate separator characters
and just stuck with the standard:
s/originaltext/replacetext/flags
Then just escape the sole slash within the regexp (if it is really
necessary - an exclusion list might be more appropriate).
Is the trailing "I" supposed to be a flag to the regexp? Please cite a sed
manpage reference for it if so. I suspect you think it means case
insensitivity (perhaps you're confusing sed's regexp with perl regexp,
which uses a *LOWER CASE* i to flag case insensitivity). even egrep
doesn't use a /I -- it uses a -i parameter. If so, you should just specify
the A-Z within your sole character class.
The single, unescaped tic mark ', within your regexp is going to _close_
the expression. If you invoked this from the commandline, this expression
wouldn't have run AT ALL, and you'd have had an error message to investigate.
etc...
As I said, it'd be a good idea to debug your sed expression before ever
introducing it to procmail. Just take a saved message and redirect it into
sed at the shell prompt.
I tried escaping the necessary characters, but it's my belief that
all the characters within the '[]' brackets are treated as individual
characters, except those having the hyphen between them.
As per regexp, yes (except that if the bracketed material starts with a
caret, which means the following characters DO NOT match). When a hyphen
starts the character class it is treated as a hyphen.
I think I tried something like \([a-z0-9/(]\|\"\|\'\|\\\) and it
wouldn't work.
Get the sed invocation to work on it's own.
You don't describe what it is you're trying to accomplish, so let me guess
that perhaps you want to _ensure_ there is a space following a _top_level
message quote. If so, try the following:
sed 's/\(^>\)\([^ ]\)/\1 \2/'
The g flag isn't necessary since the regexp is anchored to the beginning of
the line and thus is expected to match only ONCE on any line). This
conveniently avoids issues with escaping the single quote, etc.
If you want to do something different, please elaborate.
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail