procmail
[Top] [All Lists]

Re: counting the number of lines the message body

1999-12-11 13:15:58
Gary, rather than explain what went awry with your samples, I'll cut to the
chase:

 :0B # Long story, but the first condition counts one too many.
 * 1^1 ^.*$
 * -1^1
 { }
 BODYLINES = $=

If you want to count only lines that have some non-whitespace text on them,

 :0B # There is no one-too-many problem to compensate for on this one.
 * 1^1 ^.*[^    ].*$
 { }
 BODYLINES = $=

Note that only something terminating in a newline will be considered a line.
If someone sends you run-on paragraphs that are not divided properly into
lines, the recipes there will not count each fill of the screen width as a
separate line.

<Prev in Thread] Current Thread [Next in Thread>