Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!snorkelwacker!bloom-beacon!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.shell Subject: Re: ok, i've got a question... Message-ID: <1990Sep25.194425.17160@athena.mit.edu> Date: 25 Sep 90 19:44:25 GMT References: <42900@sequent.UUCP> Sender: daemon@athena.mit.edu (Mr Background) Reply-To: jik@athena.mit.edu (Jonathan I. Kamens) Organization: Massachusetts Institute of Technology Lines: 22 In article <42900@sequent.UUCP>, calvin@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@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8495 Home: 617-782-0710