ok, i've got a question...

Larry Wall lwall at jpl-devvax.JPL.NASA.GOV
Thu Sep 27 03:02:18 AEST 1990


In article <42947 at sequent.UUCP> lugnut at sequent.UUCP (Don Bolton) writes:
: In article <9651 at jpl-devvax.JPL.NASA.GOV> lwall at jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
: >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?
: >
: >If your tr works like mine, you can just say
: >
: >	tr '' '' <foo >bar
: >
: >Other possibilities:
: >
: >	sed '' <foo >bar
: >	perl -pe 's/\0//g' <foo >bar
: 
: AWK AWK ACKKKK :-)
: 
: awk -f filebelow <oldlist >newlist
: 
: { for (i = 1; i <= NF; i = i + 1)
:      { if (i >= NF)
: 	  printf("%s",$i)
:      else
: 	  printf("%s ", $i) 
:      }
: printf("\n")
: }

ACKKKK is right.

This simply dumps core on my machine.  Probably line length limitation.

The sed solution apparently works because nulls are weeded out on input
and never put into the pattern buffer.  No source handy, alas...

Larry



More information about the Comp.unix.shell mailing list