views:

278

answers:

1

Does anyone know how to convert Hex(00) to display Null in wordpad using Unix Shell Scripting.

I have an output file which is a text file and through unix I need to convert a hex value 00 to display like a box (null) in Word pad on a particular line.

Currently by using the following code I am not getting anything in my output file:

hexchar="00" octchar=$(echo "ibase=16;obase=8;$hexchar"|bc) hex1=$(echo "\0$octchar")

Please help!!!

+1  A: 

Here is one reference that might be useful.

Need to grep for null Characters in an acsii file.


The following will remove all the null characters,

tr -d "\000" < input.txt > output.txt

And, this will replace it with the X character -- take your pick,

tr "\000" "X" < input.txt > output.txt
nik