global search and replacement of a non-ascii character

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers global search and replacement of a non-ascii character
# 1  
Old 05-21-2009
global search and replacement of a non-ascii character

Hi, I need to do a global search and replacement of a non-ascii character. Let me first give the background of my problem.

Very frequently, I need to copy set of references from different sources. Typically, a reference would like this:

Banumathy et al., 2002 G. Banumathy, V. Singh and U. Tatu, Host chaperones are recruited in membrane-bound complexes by Plasmodium falciparum, The Journal of Biological Chemistry 277 (2002), pp. 3902-3912.

When I copy a set of references on to a 'vi' editor screen, the hyphen (-) character, which is invariably present in the pagination details, is shown as
<96> character. When I use the command, cat -vt <filename>, char <96> is shown as M-BM-^V

My question is, how do I search for the non-ascii character, <96> , using vi editor.

Many thanks,


NCSI, IISc, Bangalore, India
# 2  
Old 05-25-2009
Not sure about standard vi -- might depend on your OS. If you're using vim, it's no problem:

The / starts the search, as you knows this already. The CTRL-V enters a special mode (hold down CONTROL key while typing V). Now "u" stands for unicode or UTF8, and 0096 is character 96 in said mode. This is explained in the vim help pages under "mbyte-composing"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Special character replacement

Hi Guys, I have a file which needs to be replaced with tab delimited AA§Orgin Name§Mapping based on prod_usa§§§§ BB§Date§2019-08-11 23:30:01§§§§ I am trying below code sed 's// /g' test.txt Expected AA|Orgin Name|Mapping based on prod_usa||| BB|Date|2019-08-11 23:30:01|||| (6 Replies)
Discussion started by: rohit_shinez
6 Replies

2. UNIX for Dummies Questions & Answers

What is ASCII character?

Hi Guru, I have put one post yesterday and get answer. thanks for your help. my question today is: what is ascii character for following non printable characters: ( we need filter these characters out in another process) ^MM-^E^MM-^E. Old post link: ... (5 Replies)
Discussion started by: ken002
5 Replies

3. Shell Programming and Scripting

Print the next ASCII character

Hi, In my file, for few field I have to print the next ASCII character for every character. In the below file, I have to do for the 2,3 and 5th fields. Input File ======== 1|abc|def|5|ghi 2|jkl|mno|6|pqr Expected Ouput file ======= 1|bcd|efg|5|hij 2|klm|nop|6|qrs (2 Replies)
Discussion started by: machomaddy
2 Replies

4. UNIX for Advanced & Expert Users

ASCII Character Set

I thought I would point this out. This has a lot of the non printing characters. ASCII Character Set (7 Replies)
Discussion started by: cokedude
7 Replies

5. Shell Programming and Scripting

read in a file character by character - replace any unknown ASCII characters with spa

Can someone help me to write a script / command to read in a file, character by character, replace any unknown ASCII characters with space. then write out the file to a new filename/ Thanks! (1 Reply)
Discussion started by: raghav525
1 Replies

6. Programming

python, character replacement

Hello, I need to do this in python but I'm just learning py and it's quite urgent. I have a script I created and need an interactive python script to modify part of a line. MY SCRIPT #ligand prep. Uses 'ind' prefix. The initial ligand must be ind.pdb. This #generates ind.pdbqt.... (0 Replies)
Discussion started by: gav2251
0 Replies

7. UNIX for Dummies Questions & Answers

Ascii value of character?

Is there a way to determine the ascii value of a character? For example, let's say a shell variable has the value 'A'. I would like it's ascii value (e.g. 65 in this case). I would like to do this from a script (preferably ksh). (12 Replies)
Discussion started by: sszd
12 Replies

8. Shell Programming and Scripting

KSH - Character Replacement

Hey all. Easy question. I have a (ksh) varaible x. It contains the following (for example): N557788 I want to replace the "N" with a "-". I've done this before but for the life of me I cannot remember how I did it. Thanks. mtw (2 Replies)
Discussion started by: mixxamike
2 Replies

9. Shell Programming and Scripting

Character replacement

Hi, I am working on a command that replaces some occurrences of quotation marks in file. The quotation mark cannot be the first or the last character in line and cannot be preceded or followed by a comma. I am not an expert in regular expressions, but I managed to create the following... (2 Replies)
Discussion started by: piooooter
2 Replies

10. UNIX for Dummies Questions & Answers

global replacement

hello, I have a problem in replacing a value with another one in a file,the actual situation is i am writing an shell script,in that i want to cat a file and that replace the values in the file with a calculated values,which is in a variable... regards babu (2 Replies)
Discussion started by: Babu
2 Replies
Login or Register to Ask a Question

Featured Tech Videos