Article View: comp.unix.shell
Article #1254Re: ok, i've got a question...
From: Don Bolton
Date: Thu, 27 Sep 1990 02:39
Date: Thu, 27 Sep 1990 02:39
43 lines
1937 bytes
1937 bytes
In article <9677@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
>In article <42947@sequent.UUCP> lugnut@sequent.UUCP (Don Bolton) writes:
>: In article <9651@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
>: >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?
>: >
>: >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
Technical Details
Message-ID:
<43048@sequent.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!tektronix!sequent!lugnutReferences:
<42900@sequent.UUCP> <9651@jpl-devvax.JPL.NASA.GOV> <42947@sequent.UUCP> <9677@jpl-devvax.JPL.NASA.GOV>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!tektronix!sequent!lugnut From: lugnut@sequent.UUCP (Don Bolton) Newsgroups: comp.unix.shell Subject: Re: ok, i've got a question... Message-ID: <43048@sequent.UUCP> Date: 27 Sep 90 02:39:49 GMT References: <42900@sequent.UUCP> <9651@jpl-devvax.JPL.NASA.GOV> <42947@sequent.UUCP> <9677@jpl-devvax.JPL.NASA.GOV> Reply-To: lugnut@sequent.UUCP (Don Bolton) Organization: Sequent Computer Systems, Inc Lines: 43