Mailing List Archive

svn commit: r202278 - in /spamassassin/trunk: MANIFEST masses/remove-ids-from-mclog
Author: jm
Date: Tue Jun 28 13:24:14 2005
New Revision: 202278

URL: http://svn.apache.org/viewcvs?rev=202278&view=rev
Log:
add helper script to remove mass-check log lines for given IDs

Added:
spamassassin/trunk/masses/remove-ids-from-mclog (with props)
Modified:
spamassassin/trunk/MANIFEST

Modified: spamassassin/trunk/MANIFEST
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/MANIFEST?rev=202278&r1=202277&r2=202278&view=diff
==============================================================================
--- spamassassin/trunk/MANIFEST (original)
+++ spamassassin/trunk/MANIFEST Tue Jun 28 13:24:14 2005
@@ -137,6 +137,7 @@
masses/parse-rules-for-masses
masses/perceptron.c
masses/post-ga-analysis.pl
+masses/remove-ids-from-mclog
masses/rewrite-cf-with-new-scores
masses/rule-dev/maildir-scan-headers
masses/rule-qa/README.nightly

Added: spamassassin/trunk/masses/remove-ids-from-mclog
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/remove-ids-from-mclog?rev=202278&view=auto
==============================================================================
--- spamassassin/trunk/masses/remove-ids-from-mclog (added)
+++ spamassassin/trunk/masses/remove-ids-from-mclog Tue Jun 28 13:24:14 2005
@@ -0,0 +1,51 @@
+#!/usr/bin/perl -w
+
+# remove-ids-from-mclog - remove lines from a mass-check log, by ID
+#
+# usage: remove-ids-from-mclog idlist < log > log.new
+#
+# <@LICENSE>
+# Copyright 2004 Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# </@LICENSE>
+
+use strict;
+
+my $file = shift @ARGV;
+$file or usage();
+
+sub usage {
+die "
+usage: remove-ids-from-mclog idlist < log > log.new
+";
+}
+
+my %ids = ();
+open (IN, "<$file") or usage();
+while (<IN>) { chop; $ids{$_}++; }
+close IN;
+
+my $rmed = 0;
+my $left = 0;
+while (<>) {
+ if (/^[Y\.]\s+-?\d+\s+(\S+)\s+\S+/) {
+ if ($ids{$1}) {
+ $rmed++; next;
+ }
+ }
+ print; $left++;
+}
+
+warn "read ".(scalar keys %ids)." IDs, $rmed lines removed, $left left intact.\n";
+

Propchange: spamassassin/trunk/masses/remove-ids-from-mclog
------------------------------------------------------------------------------
svn:executable = *