On Tue, 2016-02-02 at 09:10 -0700, @lbutlr wrote:
> When a user moves a message from the spam box to the not spam box i
> have a script that learns that message as ham, however, the user
> would like it if the tagging of the message was removed in the
> process.
>
I do something similar when I add spam to my spam corpus. I use this
gawk script to do the job:
gawk '
BEGIN { act = "copy";
body = "no";
}
/^[A-Za-z]/ { act = "copy" }
/^X-Spam/ { act = "skip" }
/^$/ { body = "yes"; }
{
if (act == "copy" || body == "yes")
{ print }
}
' <$1 >temp.txt
It is driven by a bash script that accepts the names or one or more
message files as its arguments and runs each message through gawk.
To use it, I first copy the message(s) into my spam collection
directory and then run this script, which replaces each named spam
message with a version that has been stripped of its X-Spam headers.
I've omitted the enclosing bash script because you'll probably want
something quite different, but hopefully the gawk script will be
useful.
Martin