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 / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is subshell?

528


What is the command to find out users on the system?

572


What is shift command in shell script?

522


How to find all the files modified in less than 3 days and save the record in a text file?

608


What are the zombie processes?

565






What is $1 in shell scripting?

589


Explain about stdin, stdout and stderr?

629


How to check if the previous command was run successfully?

589


What is the syntax of while loop in shell scripting?

569


Given a file find the count of lines containing the word "abc".

950


What does $$ mean in shell script?

577


How does ls command work?

583


What is a shell environment?

572


what is tickets $ what low,medium,high priorite pls define time also

1718


What are the default permissions of a file when it is created?

498