string replacemnet

Hi,:cool:
I have several file names with .sql extension and i need to replace them with .plb extensiom.
ex:p_ebiz_vehlog.sql-->p_ebiz_vehlog.plb.

any idea pls.
cheers
RRK

for file in *.sql
do
  mv $file "${file%.sql}.plb"
done

hi vino,
The mv command renames the original file.But i dont want to rename the original file.
I want to the original file(.sql) to be remained and i just want to extract the file name without extension
and append the new extension (.plb) and store that new file name in a variable.
cheers
RRK

use cp instead of mv

No man,I dont want the contents.I need onle name of the file.

:cool:

can you please try this one out...............

var1="mysql.sql"
var2=`basename $var1 .sql`
echo $var2 => mysql
this will give you the filename without extension....then go ahead of your own manipulations..........

Hi ranjan,:cool:
Excellent......
keep it up.

cheers
RRK

Anyway, Vino already gave you the solution.
Just:

for file in *.sql
do
  echo "${file%.sql}.plb"
done

Regards.