Want to replace characters

Hi

I have searched for a way to replace odd characters in a FOLDER NAME. All search-and-replace issues I have seen, only involves how to make search-and-replace on a FILE och with TEXT INSIDE a FILE. My problem is with the FOLDER NAME.

My case is this:
I have a couple of persons that every now and then uploads files that are contained in a folder. Sometimes the foldernames get screwed up resulting in odd characters such as ^,�,, and so forth, i.e.

G^ran_F_080122

I would like to replace that "^" to an "o" and get

Goran_F_080122

How do I accomplish that?

-Arndorff

use ascii transfer mode while ftp'ng ur files...

for replacing.. sed 's/\^/o/g' file

Anchal.

Thankyou for the quick answer.

However, I am a newbie in shellscripting.
Could you please explain it in more details, I would be happy :slight_smile:

Thanks
-Arndorff

sure.. my pleasure ...
this is sed (stream editor) systex....
general syntec is s/what_to_find/from_what_to_replace/g

the value betweek the slashes may be a text/string or any regular expression ( google it if u dont know about this)

so since ^ has an special mening in regex.. s i escaped it with \.

Hope its clear...

Anchal

OK, but am I not supposed to write a loop or echo folder statement? How should I write that?

Thanks in advance
-Arndorff

I imagine you could just copy the name of the directory then do

mv (paste folder name) newfoldername

In your case,

mv G^ran_F_080122 Goran_F_080122

Escape characters ( \ ) as necessary.