I wanted to count the number of lines in the message body of an
e-mail and use it for logging purposes. In the older 3.10 procmail
that I was using, I thought the following approach worked:
:0 Bc
SIZE=| wc -l | sed -e 's/^[ ]*//'
The idea here was that the SIZE= construct appeared in pattern
matching part of the construct, and there was no action. The B
switch indicated that the match should apply only to the
message body. Again this was in a circa 1994 version of 3.10
procmail.
Well in 3.14, this construct definitely doesn't work.
After some experimenting, this worked:
:0 c
*
SIZE=|sed -e '1,/^$/ d'|wc -l|sed -e 's/^[ ]*//'
But the first thing I tried was the following:
:0 b
{
SIZE=`sed -e '1,/^$/ d'|wc -l|sed -e 's/^[ ]*//'`
}
I used 'b', thinking it might pass the text of the
body onto the rest of the filter, but procmail
told me 'b' was unecessary and therefore ignored.
I found the description of 'b' and 'h' to be
a little confusing:
h Feed the header to the pipe, file or mail destination
(default).
b Feed the body to the pipe, file or mail destination
(default).
The description makes it sound like neither 'b' nor 'h' need ever
to be supplied, and that it will not be possible to supply just one.
Do te 'b' and 'h' options only apply to filters?