GNU bug report logs - #32704
Can grep search for a line feed and a null character at the same time?

Previous Next

Package: grep;

Reported by: 21naown <at> gmail.com

Date: Tue, 11 Sep 2018 16:27:01 UTC

Severity: wishlist

Full log


Message #14 received at 32704 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>, 21naown <at> gmail.com, 32704 <at> debbugs.gnu.org
Subject: Re: bug#32704: Can grep search for a line feed and a null character
 at the same time?
Date: Tue, 11 Sep 2018 12:39:54 -0500
On 9/11/18 12:14 PM, Paul Eggert wrote:
> On 9/11/18 10:03 AM, Eric Blake wrote:
>> maybe we really do have a bug - when -z is in effect, I'd expect NUL, 
>> rather than newline, to be the byte that separates separate patterns 
>> in the pattern argument
> 
> You're right, I think it's a bug that grep -zf FILE uses newline 
> separators in FILE. It should use NUL separators.
> 
> This cannot be done for NUL bytes in command-line patterns, though, 
> since command-line arguments cannot contain NUL bytes.

Indeed.  But that merely means that on the command line, when -z is in 
effect, you can't specify multiple patterns (but instead have to use -f 
FILE if that's what you really want).  Meanwhile, the effect on being 
able to match a literal newline would be observable from either the 
command line or -f FILE.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




This bug report was last modified 4 years and 328 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.