User Tools

Site Tools


docs:tips_n_tricks:shellskripting:code:mbox.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

docs:tips_n_tricks:shellskripting:code:mbox.html [01.02.2019 13:40 CET]
peter created
docs:tips_n_tricks:shellskripting:code:mbox.html [01.02.2019 13:45 CET] (current)
peter [Find corrupted mails causing dovecot replication to fail]
Line 27: Line 27:
 cd "​$mboxdir"​ cd "​$mboxdir"​
 # Remove "​duplicate"​ mails, that differ only in Status: or X-Keywords: header lines: # Remove "​duplicate"​ mails, that differ only in Status: or X-Keywords: header lines:
-for dir in */ ; do ( cd "​$dir"​ ; \ls -1 mail.* | ( read first ; while read file ; do diff -s -I '​^\(X-UID:​ [0-9]\+\|Status:​ *[RO]\?​\|X-Keywords:​ *\)$' "​$first"​ "​$file"​ && \rm  +for dir in */ ; do ( cd "​$dir"​ ; \ls -1 mail.* | ( read first ; while read file ; do diff -s -I '​^\(X-UID:​ [0-9]\+\|Status:​ *[RO]\?​\|X-Keywords:​ *\)$' "​$first"​ "​$file"​ && \rm -v "​$file"​ ; done ) ) ; done
--v "​$file"​ ; done ) ) ; done+
 # Sort Message-ID folders for count of non-identical mails: # Sort Message-ID folders for count of non-identical mails:
 for dir in */ ; do count="​`ls -1 \"​$dir\"​ | wc -l`" ; printf "%4d %s\n" "​$count"​ "​$dir"​ ; mkdir -p "​$count"​ ; mv -iv "​$dir"​ "​$count"​ ; done for dir in */ ; do count="​`ls -1 \"​$dir\"​ | wc -l`" ; printf "%4d %s\n" "​$count"​ "​$dir"​ ; mkdir -p "​$count"​ ; mv -iv "​$dir"​ "​$count"​ ; done
docs/tips_n_tricks/shellskripting/code/mbox.html.txt · Last modified: 01.02.2019 13:45 CET by peter