procmail
[Top] [All Lists]

Re: Search Condition

2001-11-24 13:08:08
On Fri, Nov 23, 2001 at 08:51:33AM -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'

Unbalanced single quotes.  But you know that by now...

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?

Neither.  It's part of a regexp that's interpreted by sed itself.  The
string after the | is not processed by procmail, though RTFM re
SHELLMETAS.

My advice would be to make your regexp EXclusive rather than INclusive.
I'd also recommend being more specific in identifying quoted lines.  You
want something that will properly handle multiple quoted lines like:

blah blah

This of course still won't match quoted lines that put a tag in front
of the quote marker.  And it might save a little space to strip the
preceding spaces.  You could try:

| sed 's+^ *\([> ]*>\)\([^ ]\)+\1 \2+'

or in modern dialect (easier to read), with a different separator:

| sed -E 's:^ *([> ]*>)([^ ]):\1 \2:'

Or to compress *and* convert, maybe even:

| sed -E -e '/^ *>/s/ *>/>/g' -e '/^>/s/^([> ]*>)([^ ])/\1 \2/'

Ah, I love sed.  ;-)

-- 
  Paul Chvostek                                             
<paul(_at_)it(_dot_)ca>
  Operations / Development / Abuse / Whatever       vox: +1 416 598-0000
  IT Canada                                            http://www.it.ca/

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