Enter NULL characters in vi...

Marius Gedminas marius at pov.lt
Wed Mar 3 21:40:19 UTC 2010


On Wed, Mar 03, 2010 at 09:35:25PM +0000, Steve Flynn wrote:
> 	Been working on some code to clean up UTF16 encoded files and I find
> myself needing to create a test file with some NULLs embedded within it.
> 
> 	I had hoped that (in vi) Ctrl-V followed by an @ would do the trick but
> it seems not.

This works for me:

  start vim nulls.txt
  press i to enter insert mode
  type "null: ["
  press ctrl-v
  press ctrl-@
  type "]"
  hit esc
  type ":wq"
  press enter
  run xxd nulls.txt to verify:

    0000000: 6e75 6c6c 3a20 5b00 5d0a                 null: [.].

The character between [ and ] has code 0x00, as requested.

Regards,
Marius Gedminas
-- 
9. Okay, then, what do you think about "syntactic noise" in config files?

!@#@!#(#%^!%$@#';,!@# 
	-- http://open.nit.ca/wiki/index.php?page=RetchMail
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20100303/53f326e2/attachment.sig>


More information about the ubuntu-users mailing list