Skip to content

Instantly share code, notes, and snippets.

@maoueh
Created December 27, 2017 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maoueh/d26b2098f84d2228293508840ae071f4 to your computer and use it in GitHub Desktop.
Save maoueh/d26b2098f84d2228293508840ae071f4 to your computer and use it in GitHub Desktop.
##
# From shell command line, with a MySQL database dump of the videos database, this
# shell command line will print all the duplicates duplicate string.
#
# Replace the `<...>` string by actual values for your system. Also, I use
# hard-coded IP in my database which result in the used Regex
# (`"'smb://.+?/.+?\.([a-zA-Z0-9]+)'"`). It's general enough but you might need
# to update it to your needs.
#
# OS: Mac OS X (10.11.6)
# Shell: ZSH
# Dependencies: Docker
#
mkdir /tmp/kodi-mysql-dump
cd /tmp/kodi-mysql-dump
docker run -it --rm mysql:5.7 /usr/bin/mysqldump -h<DB_IP> -u<DB_USER> --password='<DB_PASSWORD>' <DB_NAME> > videos.sql
awk -v RS=, 1 videos.sql | grep -E -o "'smb://.+?/.+?\.([a-zA-Z0-9]+)'" | sort | uniq -c | grep -v '^ *1 ' | sort -nr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment