nmh-workers
[Top] [All Lists]

Re: Sort and delete duplcate messages

2020-05-04 12:54:44
I wonder if these old [n]mh FAQ things would help?  I remember using
mhfinddup a LONG time ago.

https://www.mhonarc.org/archive/html/nmh-workers/2008-09/msg00004.html

https://lists.gnu.org/archive/html/nmh-workers/2008-09/msg00001.html

https://github.com/dscho/nmh/blob/master/docs/FAQ

On Mon, May 4, 2020 at 7:23 AM Conrad Hughes <biz_nmh_workers@xrad.org>
wrote:

I know that 'sortm -textfield Subject' will sort messages accoring to
the subject field. Having run that command, is there a way to then
delete the first duplicate of each message in the list such that if 1
and 2 are duplicates and 6 and 7 are duplicates you would delete messages
2 and 7 leaving 1 and 6?

The attached might be a useful starting point: run it with a directory
name (e.g. ~/Mail) and it'll find everything that looks like an MH mail
file (i.e. its name is a number) and delete any messages with an
already-seen Message-ID — i.e. the second and subsequent copies of any
emails.

I'd run it on a duplicate of your Mail folder and see what the diffs
look like: biggest issue is that I'm not sure what order it'll do things
in so you may find your preferred copy doesn't get kept — but its output
will be a good starting point for any better version.

Conrad

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