renaming files

Hi all,

using a utility image file was named starting with blank space and a blank space in between. I want to rename the files.

file names are in the format " sb 12.tif"," sb 13.tif"," sb 14.tif" the files are in thousands. i want to rename as 12.tif, 13.tif, 14.tif....

thanks.

If your shell supports parameter substitution use

for i in *.tif                        ## most efficient
 do 
   mv "$i" "${i// /}"
 done

Otherwise use sed, awk,...

for i in *.tif
 do
   mv "$i" "$(echo $i|sed 's/ //g')"
 done

on executing the script the error meaasge
"${i// /}": The specified substitution is not valid for this command.

That's why I posted the other code.