procmail
[Top] [All Lists]

Re: problem counting lines of text

1997-10-24 12:17:29

Thanks David for thinking about my question.


It baffles me too; now, all these recipes have "B" flags; are you sure that
your method of checking also looks only at the body?  If you are using wc -l
or grep -c on the entire message, it will count qualifying lines in the head
as well.

Yes, I meant to search only the body. I carefully edited the message
discarding the header (and where appropriate, blank lines) before
counting lines. 

You'll need to tell us more, Adam.  That code works for me; in fact, it always
counts 1 too many because of the putative newline at the end.

Sorry, you are right, if it isn't an obvious error on my part I should
provide more context.  Concentrating for now just on the first recipe
that fails for me (^.*$), consider the following .procmailrc:

VERBOSE=on
LOGABSTRACT=on
COMSAT=no
SHELL=/bin/sh
LOGFILE=$HOME/procmail/logfile

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

NUMLINES = $=

INCLUDERC = $HOME/procmail/real.procmailrc

(I assume the stuff in real.procmailrc cannot possibly affect what happens 
until it's actually called.)

Now when I send this message to myself (the very message you are
reading now, truncated at this point), the logfile becomes:

procmail: Score:       1       1 "^.*$"
procmail: Assigning "NUMLINES=1"
procmail: Assigning "INCLUDERC=/ac/res/cs6/grove/procmail/real.procmailrc"
procmail: Assigning "VERBOSE=off"
From grove(_at_)research(_dot_)nj(_dot_)nec(_dot_)com  Fri Oct 24 18:56:51 1997
 Subject: Re: problem counting lines of text 
  Folder: /ac/res/cs6/grove/mh/lib/rcvstore +inbox                         1890

And yes, I then read the message I sent to myself; it's all there. 
And I'm also 100% sure that the above .procmailrc is the one that is actually
being used.
 I've read the man pages and the archives and got the impression that ^.*$ is
standard recipe for counting lines, so I remain puzzled. (Many other
scoring recipes are doing strange things for me also, but ^.*$ is probably
the simplest of them.)

 -Adam

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