procmail
[Top] [All Lists]

Losing $ in MATCH

2004-06-09 21:36:48
Sometimes a regex must include the end-of-line symbol.  But when I
want to include what was matched in a diagnostic header or log entry,
The matched $ puts an unwanted newline in the output.

Does anyone have a simple way to knock the trailing $ off when it's
there, but only when it is there?

Here's a simple example:

    :0
    * THING ?? ()\/(<.* +.*>|<[^>]*$)
    {
        LOG = "found: $MATCH
logged on the line above
"
        :0 fwh
        | formail -A "X-Diagnostic: fake Message-ID: $MATCH"
    }

If the regex matches the second part, the diagnostic header will
dump a gratuitous newline into the body;  The log entry will have
a blank line between the "found: ..." line and "logged..."

man procmailrc says: "When capturing stdout from a recipe into an
environment variable, exactly one trailing newline will be stripped."
So, I tried assigning MATCH to a variable, and printing that.  But
the result was the same,

Any ideas?

TIA,

Jim

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