On Sat, Feb 15, 2014 at 07:38:24PM +0000, Sharon Kimble wrote: > I am using this script to convert radio programmes downloaded with > 'get-iplayer' from '*.m4a' to '*.mp3', and it works very well. > > for i in *.m4a; > do faad "$i" > x=`echo "$i"|sed -e 's/.m4a/.wav/'` > y=`echo "$i"|sed -e 's/.m4a/.mp3/'` > lame -h -b 192 "$x" "$y" > rm -f "$x" > done; > > But, there is a problem. They come in this format - > '15_Minute_Drama_-_AM_Homes_-_This_Book_Will_Save_Your_Life_Episode_5_b00jdlb8_default.m4a' > > How can I lose the '_b00jdlb8_default' section please? It is always > in this format but with different letters and numbers in the section > before 'default'. > > I have quite a few programmes already converted so I also need to be > able to use this ability on them too. I would welcome another script > that could perform this please?
Just to show there's another way to do it, if you have perl installed, this should work: $ rename 's/_[^_]+_default//' *_default.* (That is, it removes "underscore, followed by some things which are not underscore, followed by underscore default" from all the files which end in underscore default).
signature.asc
Description: Digital signature