script to change file name

Hi,

on Solaris 10, with tcsh

I have 1000 files which are named something like:
IND_"SW"."YELOW_IDX1"_1280.sql

I am looking for a tcsh script to rename them without the quotes:
IND_SW_YELOW_IND1_1280.sql

Many thanks
LVL 1
peledcAsked:
Who is Participating?
 
yuzhCommented:
Why do you want to use csh/tcsh for script?
For shell scripting you should use sh/ksh, it is a lot easy to do things than csh/tcsh.

please have a look at "Csh Programming Considered Harmful":
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

Here's a ksh script can do the job for you:

#!/bin/ksh
cd /path-to/mydir   # replace it the the real dir name in your system

for file in `ls *\"*` ; do
    newname=`echo $file | tr -d \"`
    mv $file $newname
done

echo " Job done !"
exit
# End of script
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.