procmail
[Top] [All Lists]

Re: Malfunction with SED (CONTINUED #2)

2000-06-16 08:20:54
SoloCDM continued,

| The following address commands are the most successful yet, when
| executed at the bash command-line, but they refuse to work in
| .procmailrc.  I've tried several other address commands without
| success in the right direction, so where does the problem exist?
| 
|       sed ':a;N;s/^<img\nsrc[^>]*blankpixel[^>]*">//g'

First reaction is the same as Era's: is the same version of sed invoked
by procmail as the one you call from your shell prompt?  Some seds grok
semicolons and some do not.

Try this: first, drop the :a label because you're not using it (no b or t
instructions move to it); second, use multiple -e options instead of the
semicolon (or embedding newlines between sed instructions); and third, since
your search expression cannot possibly appear in the pattern space more than
once, drop the `g' flag so that sed doesn't waste time looking for more
occurrences:

       sed -eN -e 's/^<img\nsrc[^>]*blankpixel[^>]*">//'

If that doesn't work, it could be something in procmail's handing the command
over to the shell (it contains several characters from $SHELLMETAS, even
though they aren't used as such), perhaps with the quotation mark.  You could
try escaping it,

       sed -eN -e 's/^<img\nsrc[^>]*blankpixel[^>]*\">//'

which should not upset sed, or you could try temporarily unsetting SHELLMETAS
so that procmail will call sed directly instead of invoking a shell to do it:

     savemetas=$SHELLMETAS
     SHELLMETAS
     :0 flags # bf among them, I would guess
     * conditions
     | sed -eN -e 's/^<img\nsrc[^>]*blankpixel[^>]*">//'
     SHELLMETAS=$savemetas


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