Replace Language Specific Characters in File


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Replace Language Specific Characters in File
# 1  
Old 11-07-2016
Replace Language Specific Characters in File

Hi Team,

I have requirement to replace Language Specific Characters in File.
We have set of characters, it should be replaced to a different character in the file.

Quote:
Ex: "Ç" should be replaced as "C"
"Õ" should be replaced as "O"
I have around 38 characters which should replaced to different destination character.

Please help.

Thanks
Bharat
# 2  
Old 11-07-2016
Hi,

What are your attempts?

Below one could be start point :

Code:
sed -e 's/Ç/C/;s/Õ/O/g' file

It gives desired output.

i added g for global replacement if same character has to be replaced more than once.
This User Gave Thanks to greet_sed For This Post:
# 3  
Old 11-07-2016
Thanks a lot. I will test this and let you know.

Thanks
Bharat

Last edited by Don Cragun; 11-07-2016 at 10:38 PM.. Reason: Remove duplicated text.
# 4  
Old 11-08-2016
How about
Code:
iconv -futf8 -tascii//translit file
Ex: "C" should be replaced as "C"
"O" should be replaced as "O"

This User Gave Thanks to RudiC For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed command on AIX, replace specific characters

Hi, Im using sed on an AIX machine. I am trying to change the 137-139 characters if they are a ' 36'/'000' to a '036'. The positions that need to be changed are fixed. the source data that I have is$cat v.txt 4000422985400050462239065593606500000007422985707771046154054910075641MC0318AMWAY... (9 Replies)
Discussion started by: dsid
9 Replies

2. UNIX for Dummies Questions & Answers

How to replace and remove few junk characters from a specific field?

I would like to remove all characters starting with "%" and ending with ")" in the 4th field - please help!! 1412007819.864 /device/services/heartbeatxx 204 0.547%!i(int=0) 0.434 0.112 1412007819.866 /device/services/heartbeatxx 204 0.547%!i(int=1) 0.423 0.123... (10 Replies)
Discussion started by: snemuk14
10 Replies

3. Shell Programming and Scripting

Find and replace with 0 for characters in a specific position

Need command for position based replace: I need a command to replace with 0 for characters in the positions 11 to 20 to all the lines starts with 6 in a file. For example the file ABC.txt has: abcdefghijklmnopqrstuvwxyz 6abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz... (4 Replies)
Discussion started by: thangabalu
4 Replies

4. Shell Programming and Scripting

Replace specific characters until pattern

Hi experts, My file looks something like this. abcXX4,7,234 abc,defg,45XX23,74,123 The number of commas left of the XX can vary. The question is how can I replace all the commas left of the 'XX' with an underscore? abcXX4,7,234 abc_defg_45XX23,74,123 Thanks! (5 Replies)
Discussion started by: abercrom
5 Replies

5. Shell Programming and Scripting

How to replace characters in a file?

Hi Gurus, I need replace some charactors in a file. in following example. I need replace from 4th charactor to 6th charactor with x in each line. abcdefghijklmn 123456789011 excepted result: abcxxxghijklmn 123xxx789011 Thanks in advance. (6 Replies)
Discussion started by: ken6503
6 Replies

6. Shell Programming and Scripting

Awk command to replace specific position characters.

Hi, I have a fixed width file. The way this file works is say for example there are 30 columns in it each with different sizes say 10,5,2, etc... If data in a field is less than the field size the rest of it is loaded with spaces. I would like an awk command to that would replace I have... (8 Replies)
Discussion started by: pinnacle
8 Replies

7. Shell Programming and Scripting

Add characters at specific position in file

Hello I want to add some value at the specific position. My file has data like Hello Welcome to UNIX Forums Need Assistance I want to add some value at the end but at same character position for all lines. I want my output file to have data like : Here '_' represents blanks.... (3 Replies)
Discussion started by: dashing201
3 Replies

8. Shell Programming and Scripting

Replace 10 characters in file

Hi, I need to replace 10 characters string (21-30) in a file with another string. I tried using cut command, i am able get these 10 charaters, but do not know how to replace them inside the file. for example file content(these are alphanumeric characters):... (3 Replies)
Discussion started by: Johny001
3 Replies

9. Shell Programming and Scripting

Extracting specific characters from a text file

I'm extremely new to scripting and linux in general, so please bear with me. The class I'm taking gives virtually no instruction at all, and so I'm trying to learn everything off the web. Anyway, I'm trying to extract characters that follow after a specific pattern ( '<B><FONT FACE="Arial">' ) but... (3 Replies)
Discussion started by: livos23
3 Replies

10. Shell Programming and Scripting

replace characters in a file

Hi, I have a file in which i want to replace the charaters from position 3-5 with a particular string for the first line. For ex The file contains abcdefghij jkdsflsfkdk 908090900 i want to replace the characters 3-5 for the first line as 678 so, the file should look like ... (7 Replies)
Discussion started by: dnat
7 Replies
Login or Register to Ask a Question