Finding Special Character in Vi


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding Special Character in Vi
# 1  
Old 07-10-2013
Finding Special Character in Vi

Hi,

I have special characters in a file in unix which has many xml messages that comes from Messaging Queue. The loading process to the database failed due to special characters. Initially I could not able to detect it when I copy/paste in Windows editor as each line has more than 1000 characters.

So I sent the file as an email to outlook and opened it in Textpad and copied one line and pasted it in XML notepad. Then I could able to detect it.

I want to search special characters in vi editor in unix. My version of unix is AIX xxxxxxxxx 1 6 00F736154C00


For Example, lets say my file has the following content. How to find special characters that is not visible in the keyboard.
Code:
Èsldfkjsd
sdlfkjsdlfk
lskdfjsldfj
slskdfjsldfk
flsdkfjsl©
sdlfkjsdlk
lsdkfjs
sldfksdjlfk£
sljfshl
lsjdfkdj
sldkfjsldk

# 2  
Old 07-10-2013
You could search for non-word charaters if your version of vi supports is: /\W
# 3  
Old 07-10-2013
/\W searches all "W" in the file. Not able to find special character or non-word characters.
# 4  
Old 07-10-2013
Are you looking to remove these "special" characters or just find them? What codeset are you using? These "special" characters may actually be part of the codeset and be required.
# 5  
Old 07-10-2013
Right now I just want to find them. I could able to find only one Character with right Arrow. But like to see if I have any other spl char. Since the each line has more than 2000 chars, hard to find them by naked eye.
# 6  
Old 07-10-2013
Simplest tool is probably the cat utility if your version of cat has extensions such as -v -e -t.
# 7  
Old 07-10-2013
After googling, I found out the following

Vi
Code:
/[^0-9a-zA-Z,_&-\/<>?=\"\':\\\. *]

Unix Shell
Code:
grep -n "[^0-9a-zA-Z,_&-\/<>?=\"\':\\\. *]" filename

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Special character $$

Hi, on ksh What does the following do? grep -v "toolbox" $home_oracle/.profile >$home_oracle/.profile.$$ Thanks. Please use CODE tags as required by forum rules! (3 Replies)
Discussion started by: big123456
3 Replies

2. Shell Programming and Scripting

Finding a certain character in a filename and count the characters up to the certain character

Hello, I do have folders containing having funny strings in their names and one space. First, I do remove the funny strings and replace the space by an underscore. find . -name '* *' | while read file; do target=`echo "$file" | sed 's/... (2 Replies)
Discussion started by: tempestas
2 Replies

3. Shell Programming and Scripting

Escape special character

Hi, How to use * in call to pl/sql block from shell script? The line "select * from" is causing all files and directiores to show up in email notification but if I give all column names then it works, Please let me know how to use '*' instead of giving all column names, in other wirds how to... (2 Replies)
Discussion started by: sandy162
2 Replies

4. Shell Programming and Scripting

Vi special character

When editing a file, vi displays a special character as ^L. Can you tell me the escaped character to be used in awk? And can that escaped character be used in a regexp in both sed and awk? (7 Replies)
Discussion started by: dmesserly
7 Replies

5. Shell Programming and Scripting

Decimal value for special character

I am seeing an special character in my file when i do the cat filename | od-bc I see a value of 376 for that special character. I would like to find the decimal value for the character. For example the decimal value for ctrl-Y is char(25). Appreciate help on this. (11 Replies)
Discussion started by: pinnacle
11 Replies

6. Shell Programming and Scripting

Deleteing one character after an special character

I have below line in a unix file, I want to delete one character after "Â". 20091020.Non-Agency CMO Daily Trade Recap Â~V Hybrids The result should be : 20091020.Non-Agency CMO Daily Trade Recap  Hybrids i dont want to use "~V" anywhere in the sed command or any other command, just remove... (1 Reply)
Discussion started by: mohsin.quazi
1 Replies

7. Shell Programming and Scripting

Special character \

Hi, In the shell script, i need to remove the special charater "\" with "\\". For example, i need to replace "D:\FXT\ABC.TXT" with "D:\\FXT\\ABC.TXT". However, when trying to do something like , i get the below error :- -->echo "D:\FXT\ABC.TXT" | sed -e 's#\#\\#g' sed: 0602-404 Function... (7 Replies)
Discussion started by: amit_arora
7 Replies

8. UNIX for Advanced & Expert Users

grep in special character

All, I am trying to grep "-----" from a test when i use this i am getting the below error. What is the reason for this ?????... How can i over come this ##) echo "----------------- test_sys_job -----------------" | grep "-----------------" grep: illegal option -- - grep: illegal... (6 Replies)
Discussion started by: arunkumar_mca
6 Replies

9. Shell Programming and Scripting

special character

Hi, I am trying to unload file from a database. Which contains few lines with the character below. Rest of the data was unloaded appropriately. a) What does this below character means? b) How can i remove it, I already have sed '/^$/d' c) Will this effect the file by any means... (4 Replies)
Discussion started by: tostay2003
4 Replies

10. Programming

special character ?

hey there im a bit stuck on executing commands that include the special character '?'. can someone recommend a way on how i would be able to execute it?? i thought the glob function could be useful (still mite be) but upon entering the command 'ls pars?' it listed all the files in the... (1 Reply)
Discussion started by: mile1982
1 Replies
Login or Register to Ask a Question