On 12/8/05, Nix, Robert P. Nix.Robert@mayo.edu wrote:
wavfile=`echo $file | sed -e "s/mp3/wav/g"`
For what it's worth, $ echo lamp3.mp3 | sed -e "s/mp3/wav/g" lawav.wav which is probably not what's required.
$ file="bright lamp3.mp3" $ wavfile="$(basename "$file" .mp3).wav" $ echo $wavfile bright lamp3.wav
Still doesn't help if someone calls a file "Windows User.MP3". If that's a problem, then you probably do want to revert to sed: $ echo lamp3.MP3 | sed -e "s/[Mm][Pp]3$/wav/g" lamp3.wav ------end snip---------
Another solution would be: wavfile=`echo $file | sed -e "s/.mp3/.wav/g"
This works for the lamp3.mp3 example. It wouldn't work as well for lamp.mp3file.mp3
I would like to add the following: the line
lame $file $wavfile
should be replaced with
lame "$file" "$wavfile"
so that the script works fine when there are file names like
01\ -\ Supertramp\ -\ School.mp3
Paul