On Thu, 2005-12-08 at 07:42 -0600, Nix, Robert P. wrote:
-----Original Message-----
From: fedora-list-bounces(a)redhat.com [mailto:fedora-list-bounces@redhat.com] On Behalf Of
James Wilkinson
Sent: Thursday, December 08, 2005 7:32 AM
To: For users of Fedora Core releases
Subject: Re: mp3 to audio CD
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
------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
true, but the basename command would work for all I can think of since
it only applies to the specified extension.
--
Robert P. Nix Mayo Foundation
RO-OC-1-13 (new loc) 200 First Street SW
507-284-0844 Rochester, MN 55905
-----
"In theory, theory and practice are the same, but
in practice, theory and practice are different."