The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-19-2006
Castelior Castelior is offline
Registered User
  
 

Join Date: Apr 2004
Location: /FRANCE/Nantes
Posts: 38
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..
  #2 (permalink)  
Old 04-19-2006
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0