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.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / chetan
sorry, forgot to keep the "mv" command in my last post.
for i in *.sh
do
n=`echo $i|sed 's/ /-/g'`
mv "$i" $n
done
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / abc
For single file, you can do following command;
mv "interview question.sh" interview-question.sh
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / indusharma5
I tried following, but it doesn't work.
find . -name "*.sh" -0 -print0| xargs -n1 -I{} -0 sh -c '`mv {} echo "{}"|sed -n 's/ /-/g'`'
Is This Answer Correct ? | 2 Yes | 0 No |
How do scripts work?
What is the use of script interpreter in shell scripting?
Is shell scripting useful?
give me some website where i can get unix and testing meterials
Determine the output of the following command: name=shubham && echo ‘my name is $name’.
How will you connect to a database server from linux?
Is scripting and coding the same thing?
What is a program shell?
is this growing field and what is average package in this?
Explain about gui scripting?
how to print the 2-d, 3-d arrays in unix shell script programs please answer thi questio to my mail venusaikumar@gmail.com
How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?