Skip to content

Instantly share code, notes, and snippets.

@yyyyyyuanfei
Created January 8, 2012 07:26
Show Gist options
  • Select an option

  • Save yyyyyyuanfei/1577583 to your computer and use it in GitHub Desktop.

Select an option

Save yyyyyyuanfei/1577583 to your computer and use it in GitHub Desktop.
remove duplications in osx
OUTF=rem-duplicates.sh; echo "#! /bin/sh" > $OUTF; find . "$@" -type f -print0 | xargs -0 -n1 gmd5sum | sort --key=1,32 | guniq -w 32 -d --all-repeated=separate | gsed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/#rm \1/' >> $OUTF; chmod a+x $OUTF; ls -l $OUTF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment