First of all, renaming files is one of the most requested scripting questions here and on the net. A quick search or two of the archives will turn up dozens of previous threads with all the information you need.
Second, there are also already a number of ready-made renaming tools available that can do exactly what you want. A search of your distribution's software repositories should tell you what's available.
Third, please use [code][/code]
tags around your code, to preserve formatting and to improve readability.
Fourth, when you have a problem, it helps to define it clearly at the outset. You could give us some actual examples of the filenames and how you want to rename them, as well as any pertinent details about the environment and the tools you have available.
Check out the first link in my signature, and follow on from there to Eric S. Raymond's guide on how to ask questions the smart way
. Properly framing your posts will help you to get the responses you need, without wasting people's time, either ours or yours.