Richard Gooch <rgooch(_at_)ras(_dot_)ucalgary(_dot_)ca> writes:
Hi, all. I'm finding that the recipe:
* ^( )fred
| (: matched; cat)> /dev/null
is not matching when I have a line in the header like this:
(i.e. a space at the beginning of the line followed by "fred").
More complex variations of this regex also fail. Is this considered a
bug, or is it a case of "procmail is not egrep"?
To quote the procmail(1) manpage:
To make `egrepping' of headers more consistent, procmail
concatenates all continued header fields; but only inter-
nally. When delivering the mail, line breaks will appear
Therefore, lines in the header that begin with space or tab appear as
part of the line before them. There's no way in procmail itself to
match the newline that's 'inside' such a continuation. You can only
do so by calling an external program, ala:
* H ?? ? grep '^ fred'
The "H ??" tells procmail that the rest of the condition is to be applied
against just the message header. In this case, the rest of the condition
is a program action (as indicated by the next '?') so the header is fed
into the program specified by the rest of the line.
procmail mailing list