procmail
[Top] [All Lists]

Re: sort by size -- must have multigram ?

1997-01-13 18:34:31
Timothy Luoma asked,

| I am trying to do a "if this message is larger than 10KB then do  
| this" recipe.
| 
| Do I have to use multigram to do this?

No, multigram has nothing to do with that.  It's for comparing similarity of
addresses.

|       If so, how can I compile it without installing smartlist
|               (which I _can't_ do, and there is no procmail userid 
|                in /etc/sendmail.cf and I can't change that either)?

Well, yes, you can built multigram for yourself without root privileges, but
you don't need it for this anyway.

Procmail has built-in size testing conditions:

  :0
  * > 10240
  do_this

If you want to measure only the body, though, and ignore the size of the
head, it's a little more complicated, because ">" and "<" do not respond
(last I knew) to the H and B flags:

 :0B
 * 1^1 .
 * 1^1 ^.*$
 * -10241^0
 do_this

The first condition counts characters other than newlines.  The second counts
whole lines (and thus gets the number of newlines), but because of a quirk in
procmail's egrep engine, it always registers one too many.  That's why we
have to subtract 10241 instead of 10240 in the third condition.

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