procmail
[Top] [All Lists]

Re: Using sed

2001-04-21 23:48:22
Trevor Jenkins tried:

Doing something like this does work:

    SUBJECT=`formail -zxSubject: | sed "s/mail]/mail] /g"`

but this doesn't:

    TAG=`echo -n $SUBJECT|sed -e "s/\[([A-Za-z0-9\-_ ]*)\]/\1/g"`

[snip]

procmail: Assigning "SUBJECT=Re: [fetchmail]Problem with "warnings" ? "
procmail: Executing "echo -n $SUBJECT|sed -e "s/\[([A-Za-z0-9\-_ ]*)\]/\1/g""
procmail: Assigning "TAG=Re: [fetchmail]Problem with "warnings" a h"

See the ' a h' at the end?  That was the ' ?' in the SUBJECT assignment.
There are often useful-but-subtle clues that show up in verbose logs.
It (the '?') is getting filename-expanded by the shell.  Put
quotes around the $SUBJECT:

        TAG=`echo -n "$SUBJECT"|sed -e "s/\[([A-Za-z0-9\-_ ]*)\]/\1/g"`

This, should get you one step closer, but you may want to look at
Don Hammond's suggestions for the right hand side as well (sorry,
I don't have time to play with that right now.)

Hope that helps,
Stan
_______________________________________________
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>