![]() |
|
|
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 |
| get last characters in ksh | meghana | Shell Programming and Scripting | 5 | 04-11-2008 05:11 PM |
| how to get first two characters from a word | sachin.gangadha | UNIX for Dummies Questions & Answers | 4 | 12-06-2007 04:57 PM |
| replacing characters | palmer18 | UNIX for Dummies Questions & Answers | 3 | 08-20-2007 10:58 AM |
| Replace Characters... | lgardner17325 | UNIX for Dummies Questions & Answers | 8 | 10-26-2006 06:04 PM |
| Add few characters | er_aparna | Shell Programming and Scripting | 7 | 08-17-2006 11:53 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
characters ô ö à é è
Hi!
I have a file with some characters with accent. I don't find the solution to translate ô ö as o à as a é è as e ç as c With the command tr or sed? I can't write sed 's/ô/o/g' because the copy/paste ô don't work. Thanks! Last edited by Castelior; 04-19-2006 at 11:05 AM.. |
|
||||
|
Well ... Unicode is designed to make this easy in certain environments. For example, the following works on my system (bash): Code:
cbkihong@cbkihong:~$ LC_ALL=en_US.UTF-8 \ iconv -f 'iso-8859-15' -t 'utf-8' /tmp/testfile_ISO8859_15.txt \ | sed -e s/[$'\303\264'$'\303\266']/o/g -e s/$'\303\240'/a/g I don't find the solution to translate o o as o a as a é è as e ç as c With the command tr or sed? I can't write sed 's/o/o/g' because the copy/paste o don't work. (The \ are line continuation) I copied the content of your post in the file testfile_ISO8858_15.txt with the ISO-8859-15 character set, which supports all the accented characters you listed. The command converts the file into Unicode on the fly (if you have the source files in UTF-8, you can save this step!), then make use of the bash $'\nnn' syntax to refer to the character by code without literally typing them out. Here I have the first two done for you as an example. If you decide on expanding it you should be able to complete the rest. Of course you can redirect the output to a file, and/or convert the encoding as you prefer. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|