![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to replace characters 7 through 14 of every line in a file | jakSun8 | Shell Programming and Scripting | 9 | 12-13-2007 02:13 AM |
| Replace Characters... | lgardner17325 | UNIX for Dummies Questions & Answers | 8 | 10-26-2006 05:04 PM |
| Replace Special characters in a file | solai | UNIX for Dummies Questions & Answers | 1 | 07-13-2006 10:36 AM |
| Replace characters in a string using their ascii value | roops | Shell Programming and Scripting | 2 | 03-04-2005 01:51 AM |
| how to replace control characters using sed? | hillxy | Shell Programming and Scripting | 5 | 10-16-2003 10:12 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
|
||||
|
Quote:
However, I am a newbie in shellscripting. Could you please explain it in more details, I would be happy ![]() 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 |
|
||||
|
Quote:
OK, but am I not supposed to write a loop or echo folder statement? How should I write that? Thanks in advance -Arndorff |
|
||||
|
Quote:
Code:
mv (paste folder name) newfoldername Code:
mv G^ran_F_080122 Goran_F_080122 |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|