Re: egrep matches, but procmail recipe not
Ian Zimmerman <[email protected]> Sun, 16 Aug 2015 06:56:25 -0700
| Newsgroups | gmane.mail.procmail |
|---|---|
| Message-ID | <[email protected]> |
On 2015-08-16 11:06 +0200, Eric Smith wrote: > The following (negative) procmail patterns do not match: > > :0: > * ! ^(Subject|From):.*sunglas > * ! ^(Subject|From):.*Sunglasses > * ! ^(Subject|From):.*Oakley > * ! ^(Subject|From):.*Ray*Ban > * ! ^(Subject|From):.*?utf- > > procmail logs: > procmail: Match on ! "^(Subject|From):.*sunglas" > procmail: Match on ! "^(Subject|From):.*Sunglasses" > procmail: Match on ! "^(Subject|From):.*Oakley" > procmail: Match on ! "^(Subject|From):.*Ray*Ban" > procmail: Match on ! "^(Subject|From):.*?utf-" > > However, when I test with egrep for a (positive) match with these > patterns, then they do match. > > $ cat test_patterns > ^(Subject|From):.*sunglas > ^(Subject|From):.*Sunglasses > ^(Subject|From):.*Oakley > ^(Subject|From):.*Ray*Ban > ^(Subject|From):.*?utf- > > $ egrep -i -f test_patterns rayban.mail > From: "RayBan Sunglasses" <[email protected]> > Subject: =?utf-8?B?UmF5QmFuIFN1bmdsYXNzZXMgIiA=?= > From: "RayBan Sunglasses" <[email protected]> > Subject: =?utf-8?B?UmF5QmFuIFN1bmdsYXNzZXMgIiA=?= Is rayban.mail a valid email message, and do these lines occur in its header? By default procmail recipe conditions only search the header, the body is ignored. This can be changed with the B flag. Since grep -f searches for _any_ of the patterns in the file, it would help running it with one pattern at a time, so you know which one actually matched. As it is you don't know. Lastly, some of the patterns probably don't do quite what you want. ? is an extended regexp metacharacter, and Ray*Ban matches RaBan but not RayxxxBan. -- Please *no* private copies of mailing list or newsgroup messages. Rule 420: All persons more than eight miles high to leave the court.