Re: Help or feature request

Thomas Anderson <[email protected]>
Newsgroups gmane.mail.bogofilter.general
Message-ID <[email protected]>
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
> [email protected]
> http://www.bogofilter.org/mailman/listinfo/bogofilter

_______________________________________________
Bogofilter mailing list
[email protected]
http://www.bogofilter.org/mailman/listinfo/bogofilter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.