procmail
[Top] [All Lists]

Filtering digits and text from header

2003-02-10 00:20:35
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is the header I'm working with:
X-Spam-Status: Yes, hits=14.3 required=4.8
        tests=AWL,CALL_FREE,DATE_IN_PAST_12_24,DCC_CHECK,DRASTIC_REDUCED,
              FROM_HAS_MIXED_NUMS,HOME_EMPLOYMENT,INVALID_DATE,
              INVALID_MSGID,LINES_OF_YELLING,MSGID_HAS_NO_AT,
              NO_REAL_NAME,ONCE_IN_LIFETIME,RAZOR2_CHECK,
              RCVD_IN_OSIRUSOFT_COM,REMOVE_SUBJ,SMTPD_IN_RCVD,
              UNDISC_RECIPS,X_OSIRU_DUL_FH
        version=2.50-cvs-ms_1.0

I want to pull out the information in the first part (...hits=14.3 
required=4.8...) and stick
It back in to the message with a customized X-Header so it will look like this: 
hits=14.3 required=4.8.  It would be even better if I could rewrite the whole 
thing so it appeared as:  '14.3 hits :: 4.8 required'.  But just getting 
'hits=14.3 required=4.8' out is challenge enough for now...rewrite for later.


This is what I have so far:

This pulls EVRYTHING and sticks it in the header.
* ^X-Spam-Status: *\/[^    ].*
| formail -I "X-message-flag: $MATCH"

That's not right, so I try:

:0fw
* ^X-Spam-Status: *\/[^    ].*
{ SSTAT=$MATCH }
SSTAT=`echo "$SSTAT" | cut -d' ' -f2 | tr -dc "0-9.-"`
| formail -I "X-message-flag: $SSTAT"

That doesn't work either, and even if it did it would only pull out the 
'14.3'...I think.

Am I on the right track?


- -------------------------------------------
Randomly Generated Quote:
'Education is an admirable thing, but      
it is well to remember that nothing        
that is worth knowing can be taught.'      
- -- Oscar Wilde                             

Mike Loiterman
PGP Key 0xD1B9D18E
http://www.ascendency.net



-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0
Comment: This message has been digitally signed by Mike Loiterman

iQA/AwUBPkdPMmjZbUnRudGOEQKGigCdHIzWe/MyT42p2QO3wTwirVHNr0oAoMu+
hSZnpVwg7M8tkgLPExDNDSyU
=MqLv
-----END PGP SIGNATURE-----


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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