Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How do you rename the files(*.sh) with file names containing space in it?for example "interview question.sh" needs to rename to "interview-question.sh".
Appreciate your inputs.Thanks.

Answer Posted / senthil m

For single file, you can do following command;

mv interview\ question.sh interview-question.sh

For multiple files on the current working folder;

for i in *\ *.sh
do
j=`echo $i|sed "s/ /-/g"`
mv "$i" $j
done

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you emulate wc –l using awk?

1537


What command needs to be used to take the backup?

990


What is the difference between grep and egrep?

1143


Explain how you Automate your application using Shell scripting.

2319


How to print the first array element?

1039


How many fields are present in a crontab file and what does each field specify?

1132


‎What is a shell? · ‎Types of shell · ‎what is shell scripting?

984


determine the output of the following command: echo ${new:-variable}

986


How do I run a script from command prompt?

1084


What is option in shell script?

1018


Write a command sequence to find the count of each word?

994


Which scripting language is best for automation?

962


What is shell company all about?

982


What is computer cli?

909


What is the default shell of solaris?

1043