From e3ec7f6cd4204129184091a0343c49cefc4fa4b1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 28 Nov 2011 02:17:15 -0500 Subject: I should not be allowed to opperate a computer this late. --- maildups.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/maildups.sh b/maildups.sh index d309e9e..c38467d 100644 --- a/maildups.sh +++ b/maildups.sh @@ -3,11 +3,15 @@ maildir=$1 +echo 'Generating Message-ID table...' msgid_file=`mktemp` -grep -rH -m1 '^[Mm]essage-[Ii][Dd]:' "$maildir"|sort -n>"$msgid_file" +grep -rH -m1 '^[Mm]essage-[Ii][Dd]:' "$maildir"| \ + sed -r 's/(.*):[Mm]essage-[Ii][Dd]:\s*(\S.*)/\2:\1/'| \ + sort -n>"$msgid_file" < "$msgid_file" sed 's/:.*//'|uniq -d|while read msgid; do - sed -n "s/^$msgid://p"|sed 1d|xargs -d'\n' rm -fv + echo "Removing dups of $msgid" + < "$msgid_file" sed -n "s/^$msgid://p"|sed 1d|xargs -d'\n' rm -fv|sed 's/./ &/' done -rm -f "$mktemp" +rm -f "$msgid_file" -- cgit v1.2.3