procmail
[Top] [All Lists]

problem counting lines of text

1997-10-24 10:32:23

 I've just started using procmail seriously, and have encountered
the following problem. I'm sure I'm making a silly mistake, but
I have no idea what it is. Can someone help?
 I want to count the "size" of a message using various measures,
eg the number of lines, the number of blank lines, the number of
lines containing words, etc. 
 I've tried various recipes; here are three simple examples that fail for me:

:0 B
* 1^1  ^.*$
{ }

NUMLINES = $=

After this, $NUMLINES always gets set to a small number (usually 1, sometimes
2, or 3) no matter how many lines the message has. WHY?

:0 B
* 1^1  ^.+
{ }

NUMLINES = $=

:0 B
* 1^1  ^.*[A-Z]
{ }

NUMLINES = $=

I don't see how is it possible that the latter recipe gives a larger count
than the former. But that frequently happens. 
On the other hand, about half the time the ^.+ does indeed count the number of
nonblank lines correctly, but then the second recipe gives a 
count which is typically around 1/2 the number of lines containing
a letter.

I'm using v3.11pre7.

Thanks!
 -Adam Grove

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