I am seeing a lot of ^@
character in a contents of a text file on my UNIX server. I am unable to understand what does ^@
mean? and how to remove them from the file? and above all why it is generated?
If i try to see the contents of the file using cat
, I am getting this:
u3210#"! utypyado
however if try to use cat -v
, i am getting ^@
characters (as attached screenshot) along with some text in english. Same output is observed when i use vi
with :set list
command.
Any help is much appreciated , thanks very much in advance.
To find a character string, type / followed by the string you want to search for, and then press Return. vi positions the cursor at the next occurrence of the string. For example, to find the string “meta,” type /meta followed by Return.
If you're already in vi, you can use the goto command. To do this, press Esc , type the line number, and then press Shift-g . If you press Esc and then Shift-g without specifying a line number, it will take you to the last line in the file.
As the comments say ^@
is actually a null byte (\x00
) in your file.
If you want to get rid of all null byte instances then you can use this command in vi
:
:%s/[\x0]//g
You can answer the question yourself: at least, the "what character is this" part, not the "how did it get here" part. From :help ga
:
Print the ascii value of the character under the
cursor in decimal, hexadecimal and octal. For
example, when the cursor is on a 'R':
<R> 82, Hex 52, Octal 122
For more details and related commands, see the full entry.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With