Thomas Springer 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 Hope this helps, James. -- E-mail address: james | Practically any car advert, for example, shows you @westexe.demon.co.uk | that if you buy this car you will get so lost that you | end up parked (well, no. The word here is "stuck") on | a mountain in Monument Valley. -- Telsa Gwynne