All pastes #595124 Raw Edit

Anonymous

public shellscript v1 · immutable
#595124 ·published 2007-06-29 09:56 UTC
rendered paste body
#!/usr/local/bin/bash# remove spaces cause they break thisrename *.mp3 -s/\ /_/g\ls *.mp3 | while read x; 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