Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Nov 2019 20:22:06 +1100
From:      andrew clarke <mail@ozzmosis.com>
To:        Victor Sudakov <vas@sibptus.ru>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: grep for ascii nul
Message-ID:  <20191101092206.rvydwz5ezdfbsqhq@ozzmosis.com>
In-Reply-To: <20191101024817.GA60134@admin.sibptus.ru>
References:  <20191101024817.GA60134@admin.sibptus.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri 2019-11-01 09:48:17 UTC+0700, Victor Sudakov (vas@sibptus.ru) wrote:

> Dear Colleagues,
> 
> How can I print the names of files containing ascii nul (\x0)? The
> FreeBSD "grep -l" does not seem to be able to do it.
> 
> NB I don't need to delete the nul character with sed or tr, just need to
> find files containing it.

I don't believe FreeBSD (or Linux, Windows or even DOS) allows filenames
containing a null. Any regular C program that treats filenames as a
null-terminated string would correctly stop iterating over the string at the
first null.

Consequently two files named "Hello" and another named "Hello\0world" would be
seen as identical, leading to unpredictable results.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191101092206.rvydwz5ezdfbsqhq>