Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Nov 2017 21:03:22 +0300
From:      Yuri Pankov <yuripv@gmx.com>
To:        byrnejb@harte-lyne.ca
Cc:        freebsd-questions@freebsd.org
Subject:   Re: sed - remove nul lines from file
Message-ID:  <f51d6c8a-c91c-dc7c-6134-e276ec60b179@gmx.com>
In-Reply-To: <c2b1ffce6933bcb8f47c856a40d29b16.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>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 7 Nov 2017 13:01:12 -0500, James B  Byrne Via Freebsd-questions 
wrote:
> 
> On Tue, November 7, 2017 12:36, Yuri Pankov wrote:
>>
>> Apparently, our regex engine doesn't accept the '\x' syntax, try a bit
>> more complicated, but standard way :-)
>>
>> sed '/[[.NUL.]]/d'
>>
> 
> sed /[[.NUL.]]/g INFILE > OUTFILE

You want /d, not /g, to delete the *lines* which contain NUL symbols 
(that's what your subject line said).

> gives the same result as
> 
> tr < INFILE -d '\000' > OUTFILE
> 
> sed /^[[.NUL.]]$/g INFILE > OUTFILE  has no effect whatsoever.  No
> doubt because I am not specifying the record delimiters appropriately.
> 
> 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f51d6c8a-c91c-dc7c-6134-e276ec60b179>