![]() |
|
|
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 |
| Remove directory that has special Characters | datherriault | UNIX for Dummies Questions & Answers | 12 | 01-14-2009 05:53 PM |
| remove special and unicode characters | shantanuo | UNIX for Dummies Questions & Answers | 1 | 12-05-2008 09:16 AM |
| Remove lasts characters from a string | chriss_58 | Shell Programming and Scripting | 6 | 11-28-2008 06:07 AM |
| Help with find and replace w/string containing special characters | CAGIRL | UNIX for Dummies Questions & Answers | 4 | 10-07-2008 08:13 PM |
| Add string after another string with special characters | heliode | Shell Programming and Scripting | 2 | 03-21-2008 08:06 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
Great! The only character that do not work is backslah but here my new solution: Code:
~$ cat myscript
echo "$1" | tr -d "${2//\\/\\\\}"
~$ myscript 'weird string !"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' ' !"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~'
<---------------------- $1 ----------------------> <---------------- $2 ---------------->
weirdstring
~$
Thanks a lot |
|
|||||
|
Quote:
I cannot pass the special characters with a backslash because my script reads the second argument character by character. So if $2 is "\#", the script will first try to replace \ (and it fails) then try to replace # (and it fails too). Any other idea? |
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, str, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|