diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-11-28 02:17:15 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-11-28 02:17:15 -0500 |
commit | e3ec7f6cd4204129184091a0343c49cefc4fa4b1 (patch) | |
tree | 9322ca3e334033137ad4c800f12ea2399fc476f0 | |
parent | f4fd940ab17494d9d6e91facf150178e0f9d8d41 (diff) |
I should not be allowed to opperate a computer this late.
-rw-r--r-- | maildups.sh | 10 |
1 files 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" |