Solocdm asked,
| How can I make the following work in Linux with sed 3.02 and
| procmail 3.21?
|
| | sed 's+>\([a-z0-9/"'(]\)+> \1+I'
|
| 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.
OK, any time a right-side angle bracket is followed by a lower-case letter,
a digit, a slash, an apostrophe, a quote, or a left parenthesis, you want a
space inserted between them?
The problem will be including the apostrophe and the quote in the quoting
around the sed instruction. [Also, you need g as a modifier at the end if
you want it to occur more than once in a line; and I'm not sure what "I" is
supposed to do there. If it makes the search string case-insensitive,
that's
not universal among sed versions and is probably a bad idea to use in
scripting: better to include upper-case letters specifically.]
Anyhow, back to the quoting problem. It's a mess. You might try
| sed 's+>\([A-Za-z0-9/"'"'"'(]\)+> \1+g'
(enclosing the apostrophe in quotes and everything else with apostrophes),
but it's confusing to read and difficult to maintain and edit. This is a
little simpler; it encloses everything before the apostrophe in apostrophes
and all the rest with quotes:
| sed 's+>\([A-Za-z0-9/"'"'(]\)+> \1+g"
but it's scarcely any less ugly.
My best suggestion is to put the sed command into a separate file, no
quoting needed:
s+>\([A-Za-z0-9/"'(]\)+> \1+g
and to call it in your rcfile with sed's -f option:
:0f other flags # use absolute path from / or relative path from $MAILDIR
* conditions
| sed -f sedinstructionfile
That also prevents the need to unset and reset $SHELLMETAS in order to keep
procmail from calling an unnecessary shell.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail