All pastes #593841 Raw Edit

Stuff

public shellscript v1 · immutable
#593841 ·published 2007-06-28 15:59 UTC
rendered paste body
#!/usr/local/bin/bash# remove spaces cause they break thisrename *.mp3 -s/\ /_/gfor x in *.mp3; do        # output of id3ed is 'artist: Name Name' so skip the first word        artist=`id3ed -i $x | grep artist | awk '{ for (z = 2; z <= NF; z++) printf $z " " }'`        # skip first term of 'songname: Track Title' and print the rest on one line        title=`id3ed -i $x | grep songname | awk '{ for (y = 2; y <= NF; y++) printf " " $y }'`        # rename file using ID3 tag info        mv "$x" "$artist-$title.mp3"done