Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jun 1996 00:43:31 -0400
From:      "Louis A. Mamakos" <louie@TransSys.COM>
To:        "Amancio Hasty Jr." <hasty@rah.star-gate.com>
Cc:        hackers@FreeBSD.org
Subject:   Re: Ahhhhhhhhhh! 
Message-ID:  <199606110443.AAA09949@whizzo.transsys.com>
In-Reply-To: Your message of "Mon, 10 Jun 1996 17:52:44 PDT." <199606110052.RAA02092@rah.star-gate.com> 
References:  <199606110052.RAA02092@rah.star-gate.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Well, I use
> exmh + mh + glimpse + pgp 8)
> 

If you're using MH, then you may find this perl script useful.  It's
both quick and dirty.

It searches a specified folder for messages which have a Message-Id:
header field which is a duplicate of another message previously
encountered.  It adds the duplicate message to the 'dups' sequence
which you can then delete as 'rmm dups'.  Later, when this has worked
for more than a week, perhaps the script will do that as well.

louie

#!/usr/bin/perl
#
#  add duplicated messages to 'dups' sequence
#
$ENV{'MHCONTEXT'}="/tmp/mh.$$";

chop($m = `mhpath +`);
open(CTX, "<$m/context") || die "Can't open $m/context\n";
open(NEWCTX, ">$ENV{'MHCONTEXT'}") || die;
while (<CTX>) {
    print NEWCTX;
}
close(CTX);
close(NEWCTX);

foreach $arg (@ARGV) {
	if ($arg eq "-a") {
		open(FLD, "folders -fast -noheader -recurse|");
		while (<FLD>) {
			chop;
			push(@folders, $_);
		}
		close FLD;
		next;
	}
	if ($arg eq "-v") {
		$verbose++;
		$| = 1;
		next;
	}
	if ($arg eq "-l") {
		$list++;
		$verbose++;
		$| = 1;
		next;
	}
	$arg =~ s/^\+//;
	push(@folders, $arg);
}

if (!defined(@folders)) {
	chop($curfolder = `folder -fast`);
	push(@folders, $curfolder);
}

foreach $folder (@folders) {
    open(SCAN,
"scan +$folder -wi 999 -format '%(msg) %<{message-id}%{message-id}%|NONE%>'|");
    print "folder +$folder:" if $verbose;

    while(<SCAN>) {
	chop;
	($msg,$id) = split;
	next if $id =~ /NONE/;
	if (defined($IDS{$id})) {
	    push(@DUPS, $msg);
	    print "msg: $msg msgid: $id DUP of $IDS{$id}!\n";
	} else {
	    $IDS{$id} = $msg;
	}
    }
    close(SCAN);
    system "mark +$folder -seq dups -zero @DUPS";
}

unlink $ENV{'MHCONTEXT'};



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606110443.AAA09949>