Problem while using sed

hi Guys,

I have a rar file which consists of 10 files. each file has a space in its file name.
how can i replace all spaces with _
i can replace them using sed but the thing is i need to replace using a script and not command.
can anyone help me out??:confused::b:

Why don't you follow the steps below?

  1. unrar the files in archive.
  2. rename the extracted files.
  3. rar the files back to archive.

i can do it in command line but i am willing to do it in a program bcoz i have too many files

How do you do it at the command prompt?
Someone will then be able to help you write a script!

unrar e file.rar

 sed 's/ /\_/g' "file 1.txt"