procmail
[Top] [All Lists]

Re: Space at start of name

2001-03-13 11:01:16
Donal asked,

| I get the name alright but when I store it in my database, there is
| an extra space at the start of the name.

formail -x literally takes off the name of the field; since the space after
the colon isn't required, it's considered part of the value when it is
present, not part of the name.  To treat it as part of the name, include -z
among formail's options:

| REALNAME=`formail -xFrom: |\
|       tr -s ' ' '\012' |fgrep -v '@' | tr -s '\012' ' '`

Make that -zxFrom: instead of just -x.

| And the same happens for my subject:
| 
| SUBJECT=`formail -xSubject:`

As Timothy tried to show, that one is done better within procmail than by
forking another program:

 :0
 * ^Subject:[   ]*\/[^  ].*
 { SUBJECT=$MATCH }

The first set of brackets enclose space and tab; the second set enclose
caret, space, and tab.

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