Operating System - HP-UX
1748282 Members
3928 Online
108761 Solutions
New Discussion юеВ

Re: Problem reading a text file

 
SOLVED
Go to solution
Jonathan Caplette
Regular Advisor

Problem reading a text file

Hi guys,

I got this error on some text files that I'm trying to read with dtpad:

Embedded Nulls stripped from file.

I get this error with dtpad, but when I use shell commands like "cat" or "more" I can read it... I'm practicaly sure of that error is that the application that created the file, have not ended is text file correctly... But I just want to know how can I be sur of that, if it's possible to know!!

thanks
jonathan
8 REPLIES 8
A. Clay Stephenson
Acclaimed Contributor

Re: Problem reading a text file

Bear in mind that on most output devices like terminals, outputting an ASCII NUL does nothing. The data is there; it's just not displayed. If you do an 'od -t co myfile | pg' you can actually see both the characters and the octal codes.
If it ain't broke, I can fix that.
Justo Exposito
Esteemed Contributor

Re: Problem reading a text file

Hi,

You can do a cat of the file over another file, this put for you the EndOfFile character, then try to open:
cat file > filenew
dtpad filenew

Other option is use od -c but if you want to view the last line you can use tail like that:

tail -1 file | od -c

Regards,

Justo.
Help is a Beatiful word
Mark Greene_1
Honored Contributor

Re: Problem reading a text file

I can reproduce the same error by using dtpad to edit /usr/dt/lib/nls/msg/C.utf8/dtact.cat
(this also happens to be the file that contains the error message).

My guess is that any file that contains an embedded null (ascii zero, or cntrl-@) will generate this message.

HTH
mark
the future will be a lot like now, only later
nancy rippey
Trusted Contributor

Re: Problem reading a text file

You can use 'ed' to check the file.
ed filename
then enter ,l
the ,l will give you end of line, tab and other unprintable characters.

nancy
nrip
Jonathan Caplette
Regular Advisor

Re: Problem reading a text file

Actually I can read the files, but with dtpad I get the error message: "Embedded Null..." . What I wanna know is how can I, in CDE, read those file without having an error????

I tried to "cat file > newfile" then read the newfile with dtpad, and it haven't worked...

So any ideas??
Kong Kian Chay
Regular Advisor
Solution

Re: Problem reading a text file

Jonathan

* How about using "vi" ?
That is, #vi file1.txt

* To remove all control and non-printable chars so that you can use "dtpad" without error, you can consider :
#strings file1.txt > file2.txt
#dtpad file2.txt

NOTE: Even empty lines would be removed.
Steven Sim Kok Leong
Honored Contributor

Re: Problem reading a text file

Hi,

Apart from strings, you can also try col -b to remove special characters:

# cat file1.txt | col -b > file2.txt
# dtpad file2.txt

Hope this helps. Regards.

Steven Sim kok Leong
Carlos Fernandez Riera
Honored Contributor

Re: Problem reading a text file

1- tr -d "\000" <88 > 899

2- sed -n -e '1,$p' /tmp/88 >/tmp/889
unsupported