linux - grab 2 numbers from file name then insert into command -
i'm bit new programming in general , i'm not sure how go accomplish task in bash script.
a quick background: when importing music library (formerly organized itunes) banshee, of files duplicated fit banshee's number style (ex: 02. instead of 02 ) on top of that, itunes apparently did not save id3 tags files, many of them blank. i've got few thousand tags fix , duplicate files rid of.
to automate process, started learning write bash scripts. came script (which you can see here) 4 things: removes unnecessary itunes files, takes input user id3 tag information , stores in variables, clears present tag info files, writes new tags info taken user, using program called eyed3.
now, here's run problem. script blindly writing info mp3 files in dir. fine tags files have in common - artist, album, total tracks, year, etc. can't tag each individual track number method. i'm still editing track# tags 1 @ time, manually. , that's don't want 2,000+ times.
the files names this:
01. song1.mp3 02. song2.mp3 03. song3.mp3 the command write track number tag looks this:
$ eyed3 -n 1 "01. song1.mpg" so... i'm not sure how go automating this. need grab first 2 digits of each file name, store them somewhere, recall each 1 separate eyed3 command.
you can loop on files using globbing, , use substring expansion capture first 2 characters of filename:
for f in *mp3; eyed3 -n ${f:0:2} "$f" done
Comments
Post a Comment