Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Nov 2017 13:00:10 -0600
From:      Tim Daneliuk <tundra@tundraware.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: sed - remove nul lines from file
Message-ID:  <d9806d23-0e70-7edb-ca06-0d8bce9cc5f8@tundraware.com>
In-Reply-To: <88b1870184a8810072fe503917cd86be.squirrel@webmail.harte-lyne.ca>
References:  <b21bf201363c34a90ab55c4a05ff8fd7.squirrel@webmail.harte-lyne.ca> <88a59a82-2902-9f63-0a94-bd23b910e7ad@gmx.com> <c2b1ffce6933bcb8f47c856a40d29b16.squirrel@webmail.harte-lyne.ca> <f51d6c8a-c91c-dc7c-6134-e276ec60b179@gmx.com> <88b1870184a8810072fe503917cd86be.squirrel@webmail.harte-lyne.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/07/2017 12:14 PM, James B. Byrne via freebsd-questions wrote:
> Sigh.  Thank you.  That works.  However, it also deletes any line that
> has even one NUL in it regardless of the presence of other non-nul
> characters on the line.

Methinks we need a more rigorous statement of reqirements here :)
To whit:

- A 'line' is something that  ends with "\n".

- Any line that _only_ contains one or more NULL chars is to be removed
  entirely.

- Any line that contains one or more NULL chars _and_ other chars is
  to have those NULLs removed, leaving the remainder of the line intact.

- An empty line ("\n" only) is to be left untouched.

Is that correct?

-- 
----------------------------------------------------------------------------
Tim Daneliuk     tundra@tundraware.com
PGP Key:         http://www.tundraware.com/PGP/




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d9806d23-0e70-7edb-ca06-0d8bce9cc5f8>