nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] sorting on X-Spam headers

2005-04-27 11:51:41
On 27 April 2005 at 12:38, Michael Richardson 
<mcr(_at_)sandelman(_dot_)ottawa(_dot_)on(_dot_)ca> wrote:
Does anyone have any solutions to sort on spamassassin headers?
I.e. I want to sort my inbox on:

     X-Spam-Status: No, hits=-31.6
                             ^^^^^
this number.

You could do it with a short script.  Feed the script a list of message
numbers and X-Spam-Status header fields with this:

scan -format '%(msg) %{x-spam-status}'

The output of that will look like this:

1 No, hits=-31.6
2 Yes, hits=23.2
3 No, hits=1.3
...

Parse out the info you want, then sort, then reorder the messages.  I
haven't written code to reorder messages, but one easy way I can think
of is to first rename all the messages starting with two commas (,,) or
hash marks (##) -- sort of like "rmm" does, but with two of the
characters so there won't be conflicts with any "removed" messages in
the folder.  Then give the messages their new names.  That idea must
have gotchas... one is that if you interrupt the sort, your messages
will all be gone. 8^}  Maybe someone has a better idea...

Jerry


_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
http://lists.nongnu.org/mailman/listinfo/nmh-workers

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