Extra symbols when vi a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extra symbols when vi a file
# 1  
Old 03-07-2012
Extra symbols when vi a file

When i try to vi a file, see some extra characters "l^H^@^@^@^@^F^@"...but when i cat the same file i am not seeing this...How do i remove this???
# 2  
Old 03-07-2012
Those are control characters that vi interprets and displays, but which have no printable equivalent so you do not see them via cat.

If you are in vi, just position over the "^" and press "x" to delete.

---------- Post updated at 02:28 PM ---------- Previous update was at 02:24 PM ----------

This chart shows control characters if you are wondering what those characters are. i.e. ^H = CTRL-H which is a backspace.
ASCII Table - Control characters
# 3  
Old 03-07-2012
This is clearly not a normal unix text file. Before considering any processing in unix text file manipulation utilities such as vi please look at the source of the data and consider whether it can be presented in the form of a unix text file.
The data presented looks like a database binary file and is therefore unsuitable for editing with unix text file utilites.
What software wrote this file? Can the data be extracted as a unix text file?

Please also post what Operating System and version you are running and what Shell you prefer.

Last edited by methyl; 03-07-2012 at 06:24 PM..
# 4  
Old 03-08-2012
Excellent point. I was going under the assumption there were extraneous characters in a normal text file that were not expected to be there since cat seemed to display the file as expected.

Make sure you are not trying to edit a data file or an executable file if its origin is unknown. The file command may be useful in investigating.
# 5  
Old 03-08-2012
Do you need the characters if you do a cat -v filename > filename2?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

File Containing Extra delimiter should be removed

The input file is this: a|b|c|d x|y|z|n||||||||| p|q|r|s||| g|h|i| w|e|r|| Now as per requirement , each row should have only 3 delimiter. Now the 2nd row & last row has an extra delimiter, How to remove that ? In some large file having 100K data , there can be 100 such rows having... (4 Replies)
Discussion started by: ikdKunal
4 Replies

2. Shell Programming and Scripting

Extra data in output file

Gents, I did a small scritp called make_file It read file1.txt file and generate an output as attached.. But the script is showing more extra information not needed. I have attached the output file as desired. Could you please help to fix this scrip to get the correct output Thanks... (4 Replies)
Discussion started by: jiam912
4 Replies

3. Shell Programming and Scripting

Removing extra lines from file

I have a file where data looks like this: === <?xml version="1.0" encoding="utf-8"?> <xml xmlns:s='uuid:XYZ' xmlns:dt='uuid:ABC' xmlns:rs='urn:schemas-microsoft-com:rowset' xmlns:z='#RowsetSchema'> <s:Schema id='RowsetSchema'> <s:ElementType name='row'... (7 Replies)
Discussion started by: vx04
7 Replies

4. Shell Programming and Scripting

removing the words with symbols in a file in unix

I have file like below Hi iam author <br>joseph</br> in france. I live in my home <br></br> but no food. I will play footbal <br></br> but i wont play cricket. I will read all the books <br>all fiction stories</br> i hate horror stories. I want output like below Hi iam author... (3 Replies)
Discussion started by: vinothsekark
3 Replies

5. Shell Programming and Scripting

Removing Symbols From a File like the copyright symbol

Hi guys, I have a txt file full of funny symbols like the copyright symbol and other funny ones that get in the way when trying to use sed. For example, not sure if you can read this but I have a line that looks like this: 24(9):995Â*1001 DOI: 10.1007/s11606-009-1053-2 © When I'm using... (1 Reply)
Discussion started by: joshdg
1 Replies

6. Shell Programming and Scripting

m4 adds extra space at top of file.

I have used m4 in the past to generate source code where aesthetics and space were of no consequence . Now I am using it to generate script and program templates . So here is an excerpt from my m4 file for producing a generic bash script: dnl `$Id$' define(`START_SCRIPT',`#!/bin/bash... (8 Replies)
Discussion started by: Bubnoff
8 Replies

7. Shell Programming and Scripting

sort file adding extra character

HI all i have this script : #!/bin/bash sort /usr/tmp/"REPORT"$1 -o \ /usr/tmp/"SREPORT"$1 -k 1,7 -S 150 end of script now i'm doing this command : ls -lsgt *REPORT* 4 -rw-r--r-- 300 Sep 16 REPORT54784 4 -rw-r--r-- 301 Sep 16 SREPORT54784 as you can see the sorted file... (5 Replies)
Discussion started by: naamas03
5 Replies

8. Shell Programming and Scripting

Truncate extra contents from file

Hi all, i have a file and i want that after 6th slash "/" in each line of the file the contents gets truncated. Can anyone tell me how to do that !! thanks in advance One more thing how can i change the size of output buffer of console, as i had very long output and its not... (2 Replies)
Discussion started by: glamo_2312
2 Replies

9. Shell Programming and Scripting

Urgent: How to eliminate special symbols in a file and how to read it

Hi, I have file called suppliersList.txt --------------------------------- 112|MIMUS|krish@google.com 113|MIMIRE|krish@google.com 114|MIMCHN|krish@google.com 115|CEL|krish@google.com 108|UGEN|krishn@google.com 109|SLAND|krish@google.com i have 3 varibale ------------- no Name... (4 Replies)
Discussion started by: kittusri9
4 Replies

10. Shell Programming and Scripting

remove extra lines in the file

Hi, I have some files, with some extra lines in weird characters on the top and bottom of the. I want to get rid of those line. Is there a way I can do that? example of the input file. I want to get rid of those lines in bold (B ... (8 Replies)
Discussion started by: CamTu
8 Replies
Login or Register to Ask a Question