Help or feature request

Thomas Anderson tanderson at orderamidchaos.com
Tue Sep 8 17:50:23 CEST 2009


On Mon, 2009-09-07 at 09:31 -0400, Ed Blackman wrote:
> This should do the trick:
> 
> #!/bin/sh
> 
> db="$1"
> top="$2"

This should be count="$2", right?

Tom

> 
> # error if the bogofilter database doesn't exist
> if [ ! -e "$db" ]; then
>    echo "Usage: $0 <db> <count>" >&2
>    exit 1
> fi
> 
> # error if no count is given
> if [ -z "$top" ]; then
>    echo "Usage: $0 <db> <count>" >&2
>    exit 2
> fi
> 
> # filter the <count> most recent entries into a temp db
> bogoutil -d "$db" | sort -rk 3 | head -$count | bogoutil -l "$db.tmp"
> 
> # if the temp db exists and can be dumped, replace the original
> if [ -s "$db.tmp" ] && bogoutil -d "$db.tmp" >/dev/null; then
>    mv "$db.tmp" "$db"
> fi
> 
> Ed
> _______________________________________________
> Bogofilter mailing list
> Bogofilter at bogofilter.org
> http://www.bogofilter.org/mailman/listinfo/bogofilter




More information about the Bogofilter mailing list