remove accents and symbols with sed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting remove accents and symbols with sed
# 1  
Old 01-06-2009
remove accents and symbols with sed

Hi, I would like to know how could I remove accentes and the symbols: º and ª of a text file with sed. Whis this command doesn't works :-( sed "s/í/i/g" filename Many thanks and sorry for my english!
# 2  
Old 01-06-2009
These characters are UTF-16?
# 3  
Old 01-06-2009
Please use this command
sed -e "s/\º//g" -e "s/\ª//g" tt1.txt> tt2.txt

I have tested it with this input
tt1.txt input file contains
helªlo º helªlo2º
helªlo3º

output file tt2.txt comtains
hello hello2
hello3
# 4  
Old 01-06-2009
Quote:
Originally Posted by mitthan
Please use this command
sed -e "s/\º//g" -e "s/\ª//g" tt1.txt> tt2.txt

I have tested it with this input
tt1.txt input file contains
helªlo º helªlo2º
helªlo3º

output file tt2.txt comtains
hello hello2
hello3
Sorry doesn't work me In te text, the caracter ª if I do a vi it show me well, but when I do a sed from this text shows me a extrange caracter in substitusion to ª, it shows me a interrogation mark like inside of a sqare if I try to paste the line where the character is (ctrl+c, ctrl+v) but it shows: on - 8� Any help?
# 5  
Old 01-06-2009
That's why we need to know your locale settings.
# 6  
Old 01-06-2009
Quote:
Originally Posted by jim mcnamara
That's why we need to know your locale settings.
avid@defekas:~$ echo $LANG es_ES.UTF-8 Thanks
# 7  
Old 01-06-2009
sed -e 's/^[ ]*Width:[ ]*//' -e 's/[ ]*$//'`

try this way ..you need to change according to your format in the file
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Removing unwanted symbols with sed

I would like produce blue, green, red, yellowfrom"blue:,*green:,*red:,*yellowI can remove the colon with echo "blue:,*green:,*red:,*yellow" | sed 's/://g'which givesblue,*green,*red,*yellowbut when I try echo "blue:,*green:,*red:,*yellow" | sed 's/://g'; 's/*//g'I get bash: s/*//g: No such... (9 Replies)
Discussion started by: Xubuntu56
9 Replies

2. Shell Programming and Scripting

Sed, how replace specific symbols between two patterns

I have a big xmltv file with many lines like: <?xml version="1.0" encoding="UTF-8"?> <tv> <channel id="channel 1 +3HD"> <display-name lang="it">channel +3HD</display-name> <icon src="http://mywebsite.com/dsgbnjfdc65657/channel +3HD.png" /> ... (8 Replies)
Discussion started by: Tapiocapioca
8 Replies

3. Shell Programming and Scripting

awk to remove line if field has symbols in it

Trying to use awk to remove a line only if $1 contains either ; or :. Thje awk below runs but no lines are removed. Thank you :). awk awk '$1 !~ /;/ || $1 !~ /:/ { print }' file file AARS2;TMEM151B 1 AASS 2 ABAT 3 ABCA1 3 ABCA10 1 ABCA12 2 ABCA13 1 ABCA13:AX746840 2 ABCA2 5 (5 Replies)
Discussion started by: cmccabe
5 Replies

4. UNIX for Dummies Questions & Answers

sed command for removing symbols

Hi I am trying to remove all the symbols in a file (testfile1) and using the below command to do that. Its not working for me. Can you help me on what is wrong with below script? I want to retain only alphabets in a file and remove all the symbols like *:.+= etc sed 's/^.//g' testfile1 > testfile2 (4 Replies)
Discussion started by: sandeepcm
4 Replies

5. Slackware

cp does not like filenames with accents?

Hi: mkisofs -graft-points -rational-rock -joliet -joliet-long -full-iso9660-filenames -iso-level 2 -o /tmp/image.iso STORE1/=/almacen/strauss In /almacen/strauss there are filenames containing not only spaces but accented characters as well. I burned the image to DVD, with the result that all... (2 Replies)
Discussion started by: stf92
2 Replies

6. Shell Programming and Scripting

Problem with using a sed to add escape character \ before $ and ' symbols

Hi all, I've got a problem with sed. Want to use it to add escape character \ before $ and ' symbols so condition='1'$some will become condition=\'1\'\$some echo "condition='1'$some" | sed 's/\($\)/\\\1/g' is not working properly. Can somebody help me with this please? Regards,... (7 Replies)
Discussion started by: johny_be_good
7 Replies

7. Shell Programming and Scripting

how to remove weird symbols

Hi my file is suffering from some weird text symbols like a question mark inside of a square. I don't know how to remove these. I tried to remove UTF accents with command sed -e 's/^*Width:*//' -e 's/*$//'` but no use . Could u guyz plz help me. (4 Replies)
Discussion started by: repinementer
4 Replies

8. Shell Programming and Scripting

How to replace symbols by position using SED

Hi all, I need your help. For example I have string in file.txt: -x -a /tmp/dbarchive_NSS_20081204 -f 900 -l 1 2008/12/04 2008/12/04 So, I need to replace symbols from (for e.g.) position 26 till 33 with symbols which I have in file replace.txt And I have no idea how to do it. If... (1 Reply)
Discussion started by: nypreH
1 Replies

9. Shell Programming and Scripting

new lines symbols in sed?

I want to edit a huge script file using sed. How can I add the new lines symbols in the red colored places? sed -e "s/test -z "$x"/if test -z "$x" then echo -1; \n else \n/g" (1 Reply)
Discussion started by: gogogo
1 Replies

10. UNIX for Dummies Questions & Answers

Error When Print Accents

I like to know how to print accent when use the command lp -d <file>. This <file> contain the following accents (e.g. é, á, ê, ã, ç) and anothers accents, please i need to help. thank´s (0 Replies)
Discussion started by: edvaldo
0 Replies
Login or Register to Ask a Question