#!/bin/bash # # I had some mp3-files that were repeated twice inside themselfes. # It looked like someone copied them one day with append command. # The script splits such files into to equal parts and checks if # those parts are coinside. # for f in *.mp3 ; do # Calculate size of the file size=`du -b "${f}" | cut -f 1` half_size=`echo ${size}/2 | bc` # Split file into two parts f1="$f".1 f2="$f".2 head -c $half_size "$f" > "${f1}" tail -c $half_size "$f" > "${f2}" # Calculate checksums and check if they coinside md1=`md5sum "${f1}" | cut -f 1 -d " "` md2=`md5sum "${f2}" | cut -f 1 -d " "` if [ ${md1} != ${md2} ] ; then echo "Problems with $f" fi done
Imagine, you could type the title of this blog in your command line. Here is a possible result of the command.
Sunday, November 8, 2009
How to fix some sort of mp3-files
Subscribe to:
Posts (Atom)