Skip to content

Instantly share code, notes, and snippets.

@alishir
Created July 10, 2013 19:06
Show Gist options
  • Select an option

  • Save alishir/5969189 to your computer and use it in GitHub Desktop.

Select an option

Save alishir/5969189 to your computer and use it in GitHub Desktop.
remove duplicate files
duff -r * > duplicate.txt
csplit -z -f dup_ duplicate.txt /files\ in\ cluster/ {*}
for dup in `ls dup_*`;
do
cat $dup | while read l;
do
if [[ $l =~ .*_.* ]];
then
echo "keep: $l";
else rm "$l";
fi;
done;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment