nmh-workers
[Top] [All Lists]

Re: Sort and delete duplcate messages

2020-05-03 20:19:49
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?

I want to say you could do something with piping the output of scan
into "uniq -d -f <num>".  Might require a custom scan format, but that
seems relatively simple.

Hm, a quick test:

% scan -format '%(msg) %{subject}' | uniq -d -f 1

suggests that it prints the first one, not later ones, so that isn't
exactly what you want.  Might be a good starting point, though?  You could
probably do something with uniq -c and pipe that to an awk script that
did what you wanted.

--Ken

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