Bash and substring removal

Page content

Deletes shortest match of $substring from back of $string.

${string%”$substring”}

Example

find /var/files -name "*.mp3" | while read string;  
do  
mv$ $string ${string%"mp3"}wav  
done
Will strip mp3 of the end of the string and add wav