1833051 Members
2654 Online
110049 Solutions
New Discussion

null char in text file

 
SOLVED
Go to solution
Jimmy_13
Advisor

null char in text file

I have a developer server whit hp-ux 11i.
The developers users ask me how they can insert a char null in the a text file.
They view the text file in hexadecimal format and search the 00 value that is the null char.
They need to now how write the null character in the text file, the null character is the 00 in hexadecimal

How i can write this char?
4 REPLIES 4
John Poff
Honored Contributor

Re: null char in text file

Hi,

I'm not at work so I can't test this, but I would try something like this:

echo "\000" >>text.file

JP
Sridhar Bhaskarla
Honored Contributor
Solution

Re: null char in text file

Hi,

It depends on where you want to insert the null character. I use 'tr' to accomplish this. For ex., to replace End of Line with a null char , I would do the following

tr "\n" "\0" < your_file

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
john korterman
Honored Contributor

Re: null char in text file

Hi Jimmy,

# printf "\0"

regards,
John K.
it would be nice if you always got a second chance
Jimmy_13
Advisor

Re: null char in text file

Thank a lots, the solutions of Sridhar Bhaskarla
work perfect.