[英]How can I insert control character ^@ into a file using sed in Linux?
I am running below command on file xyz
. 我正在文件
xyz
命令下运行。
sed -i 's/abc \"/abc \^@\"/g' xyz
But I am not getting desired output. 但是我没有得到想要的输出。
If I manually typing ctrl + v + @ it is visible in vi editor as ^@
but not with above command output. 如果手动输入ctrl + v + @ ,则在vi编辑器中显示为
^@
但在上面的命令输出中不可见。
The character you are referring to is a null byte ( 0x00
). 您所指的字符是一个空字节(
0x00
)。 In sed you need to use \\x00
for it: 在sed中,您需要使用
\\x00
:
sed 's/abc \"/abc \x00\"/' file
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.