can someone tell me why sed won’t remove my NULLs?
this is on OS X
$ printf '123\x00456' | sed 's/\x00/Z/g' | hexdump
0000000 31 32 33 00 34 35 36 0a
this doesn’t work either:
$ printf '123'$(echo "\000")'456' | sed 's/'$(echo "\000")'/Z/g' | hexdump
0000000 31 32 33 00 34 35 36 0a
For deleting a single character or translating a single character to a single other character (not including multibyte characters),
trcan do it, and unlike sed it supports all characters, including NULs, in all versions of unix since the beginning.For translating:
And for deleting: