ok, i've got a question...

Jonathan I. Kamens jik at athena.mit.edu
Wed Sep 26 05:44:25 AEST 1990


In article <42900 at sequent.UUCP>, calvin at sequent.UUCP (Calvin Goodrich) writes:
|> ...for the unix.gods out there. i have a file that has a whole mess of
|> null characters in it ('bout 1/2 a meg). is there any way (preferably
|> a shell script) to strip them off?

  Well, since "tr" deletes NULLs from its input, you could do "tr '' '' <
filename > filename.nonulls".

  Then again, "sed" apparently also deletes NULLs, so you could do something
similar with it: "sed -n p < filename > filename.nonulls".

  Both of those solutions are pretty much just hacks that rely on the fact
that tr and sed delete NULLs.  There's probably a more correct (i.e. it's
doing what it's doing explicitly, rather than relying on a fluke in a program)
solution in perl, but I'm religiously against posting perl scripts to the net,
since so many other people do it so much better than I :-).

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710



More information about the Comp.unix.shell mailing list