[ILUG] Strip first three characters from filename

john Moylan john at nuatech.net
Sun Aug 10 11:30:22 IST 2008


sorry, my mistake. The previous example should have read:

for i in `ls *.mp3`; do mv ${i} `echo ${i} | cut  -d "_" -f2-`; done

Just a different way of doing things.

J

2008/8/10 john Moylan <john at nuatech.net>

> for i in `ls *.mp3`; do cut  -d "_" -f2-; done
>
> 2008/8/10 <ollie at eillo.org>
>
>
>> I have a ton of mp3 files that I'm currently sorting the id3 tags for.
>> Each filename starts with the tracknumber followed by an underscore.
>>
>> e.g. 01_SONG_NAME_-_ARTIST_NAME_-_ALBUM_NAME.mp3
>>
>> Because i have a unique separator between the SONG, ALBUM and BAND name
>> '_-_'
>> i can use my audio tag software to populate the ID3 tag fields
>> appropriately.
>>
>> However the track number is separated from the band name by an underscore
>> and the
>> software isn't flexible enough to tell the difference.
>>
>> So i need a shell script that will loop through a directory and
>> strip the first three characters from each filename.
>>
>> Can this be easily done in shell?
>>
>> If not i can do it in python but id rather not.
>>
>> Cheers,
>>       Oliver.
>>
>> --
>> Irish Linux Users' Group mailing list
>> About this list : http://mail.linux.ie/mailman/listinfo/ilug
>> Who we are : http://www.linux.ie/
>> Where we are : http://www.linux.ie/map/
>>
>
>



More information about the ILUG mailing list