I'm trying to write a small shellscript to fix my MP3 tags, and thanks to Google I've concluded that bash+awk is the way to go.
All my music is in the format 01 - Bruce Springsteen - Born to Run.mp3 (track number - artist - track).
In addition, the mp3 files are always stored in a directory with the album name, so just based on the filename and location, I should be able to get
ARTIST
ALBUM
TRACK
NUMBER
However, my programming capabilities are to say the least rusty, so even my small attempt to start fails with a crude error (Invalid pointer):
Code:
!/bin/sh
CURDIR=`pwd`
ALBUM=`basename "$CURDIR"`
echo $ALBUM
for file in *.mp3 ; do
echo $file
awk -F"-" '{ print $1 }' $file
done
Could anyone kindly point me in the right direction for how to get the track number (awk print $1), artist ($2) and track $3 into the right variables so I can then pass it on to id3tag to strip all v1 tags and properly set the v2 tags?
Thanks in advance for any insight
-Y1