You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Belette <kr...@gmail.com> on 2006/03/29 13:32:48 UTC

SA scores

hello there !

IS there a way to get SA scores using a shell command :

e.g. :
# spam -score < mail.txt
# .045


i need this coz i do not want to filter all mails, i just need a score,
without writing SA header inside it

Thx

Re: SA scores

Posted by mouss <us...@free.fr>.
Belette wrote:
> hello there !
> 
> IS there a way to get SA scores using a shell command :
> 
> e.g. :
> # spam -score < mail.txt
> # .045
> 


depends on which headers you SA adds.

*) X-Spam-Score

(usually added with:
	add_header all Score _SCORE_
).
If it looks like:
	X-Spam-Score: -0.1

then:

sa_score=`grep -m 1 "^X-Spam-Score: " $file | sed 's/X-Spam-Score: //'`

*) with a header of the form:

X-Spam-Status: No, score=-99.999 required=5 tests=[HTML_MESSAGE=0.001,
	USER_IN_WHITELIST=-100]

sa_score=`grep -m 1 "^X-Spam-Status: $file |\
	awk -F"[ =]"  '{print $4;}'`


you can "sed" if you prefer (sed 's/.* score=//' | sed 's/ .*//' instead 
of the awk cmd).


adjust to match your headers.





Re: SA scores

Posted by Belette <kr...@gmail.com>.
yeah thx, but the result is a very long text.
in fact, i need to use the score as a number.
( for an intern use )

maybe a shell script will be usefull....

is there any way to get this score in a shell script and use it in it... (
as a variable )

i do not want to use spamc -R file.txt | grep .... etc
maybe RE can match it ?

On 3/29/06, Johann Spies <js...@sun.ac.za> wrote:
>
> On Wed, Mar 29, 2006 at 01:32:48PM +0200, Belette wrote:
> >    hello there !
> >
> >    IS there a way to get SA scores using a shell command :
> >
> >    e.g. :
> >    # spam -score < mail.txt
> >    # .045
> >
> >    i need this coz i do not want to filter all mails, i just need a
> score,
> >    without writing SA header inside it
>
> spamc -R < mail.txt
>
> Regars
> Johann
>
>
> --
> Johann Spies          Telefoon: 021-808 4036
> Informasietegnologie, Universiteit van Stellenbosch
>
>      "Trust in the Lord with all your heart and lean not on
>       your own understanding; in all your ways acknowledge
>       him, and he will direct your paths."  Proverbs 3:5,6
>

Re: SA scores

Posted by Johann Spies <js...@sun.ac.za>.
On Wed, Mar 29, 2006 at 01:32:48PM +0200, Belette wrote:
>    hello there !
> 
>    IS there a way to get SA scores using a shell command :
> 
>    e.g. :
>    # spam -score < mail.txt
>    # .045
> 
>    i need this coz i do not want to filter all mails, i just need a score,
>    without writing SA header inside it

spamc -R < mail.txt

Regars
Johann


-- 
Johann Spies          Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

     "Trust in the Lord with all your heart and lean not on 
      your own understanding; in all your ways acknowledge  
      him, and he will direct your paths."  Proverbs 3:5,6