ok, i've got a question...
Don Bolton
lugnut at sequent.UUCP
Thu Sep 27 12:39:49 AEST 1990
In article <9677 at jpl-devvax.JPL.NASA.GOV> lwall at jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
>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.
Hmmmm.. did you try cat oldlist | awk -f filebelow > newlist ? Thats
the way I've been running it. Also, on line 2 >= NF can be changed to
== NF (this was my first venture into deeper awk actions) That shouldn't
be the cause of the core dump though.
>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