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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: grep; Severity: wishlist; Reported by: 21naown@HIDDEN; dated Tue, 11 Sep 2018 16:27:01 UTC; Maintainer for grep is bug-grep@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 32704 <at> debbugs.gnu.org:


Received: (at 32704) by debbugs.gnu.org; 17 Sep 2018 15:57:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 17 11:57:00 2018
Received: from localhost ([127.0.0.1]:43284 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g1vtU-0007rg-Er
	for submit <at> debbugs.gnu.org; Mon, 17 Sep 2018 11:57:00 -0400
Received: from mail-ed1-f51.google.com ([209.85.208.51]:33228)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <21naown@HIDDEN>) id 1g1vtS-0007rS-H7
 for 32704 <at> debbugs.gnu.org; Mon, 17 Sep 2018 11:56:59 -0400
Received: by mail-ed1-f51.google.com with SMTP id d8-v6so13371968edv.0
 for <32704 <at> debbugs.gnu.org>; Mon, 17 Sep 2018 08:56:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:subject:to:references:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding:content-language;
 bh=px7Neot5LFdrU8i36eF2a7OaysPEd6d7zK6YpX+aQHQ=;
 b=p870wXGtIODj/AgoOQ2DQnpZvpaqDY1cF8bzE1/jvUwa5ekbwP4SR3mHcmPR7UNldZ
 q7+doEvwVEWusaYk/Ni1Yv5CLJ8OcDewis+T3UCGNPBCOCeo3z5Ql20ANx5WhktHaG7g
 69vMOJFYXbYJF3G1XliF9HfEs8H52t5HPa9n7lsstUsl4B33oa5ZC9aCoqtophJwNur+
 YPGJG1AlMtUytaqosBeq2b/YUYpbigqeY2EY3dxDxgRda25Djes2PwACK2DoDrG/XZkp
 2VCdn4tvkH9GBlEhnxwW30gdpVDtWygNWhFXNSy4N+fexHONyqtrhG4lvXug8FBmATpP
 +oqA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:subject:to:references:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding
 :content-language;
 bh=px7Neot5LFdrU8i36eF2a7OaysPEd6d7zK6YpX+aQHQ=;
 b=VhKx0447DiFOZCzQwY5zdrL7bOY9E9uHZAGON7GBf94mkEj9DRfKS8vrdnEtP75tvP
 Y4wgrETUDiQ5PiEviCI2vAL72UOidB59a1nkiXODC2gIjVLxBlby0dYRlG8bazmG0csO
 YGuGj3rMb2RfY3rskVb1KZHlSSU138ihJe3ncYwU8qJ9QcD/HSWJnjKP/7eOb/8BOhNB
 VEB4OMjiIKyrEGZKFIeJ9BU/qCzo/DN4HzdlCZAz9ntx1abYmm3VVWggbnesCE5ESsxP
 GmZXAFMb2i43oQlnYktolczbJZTZNXf1gyTLRwrQe28PUAfeKeUrgYJt8kfhhGgeludI
 L0Ag==
X-Gm-Message-State: APzg51DjysXuJwzeB5C+TxO2eAffd9CgQBhHILe/x8Qu7+h7AzwsS7ZO
 h+KsZlQqdOVfhoJHolQp5Og=
X-Google-Smtp-Source: ANB0VdaNyMzBn16no165e4UUfRkus/CimH8yhP3iLda59Qn9onhtrA57tvKAitxJOTgQxI2eU6zgDg==
X-Received: by 2002:aa7:d80e:: with SMTP id
 v14-v6mr45353892edq.255.1537199812696; 
 Mon, 17 Sep 2018 08:56:52 -0700 (PDT)
Received: from [192.168.1.2] (152.232.12.109.rev.sfr.net. [109.12.232.152])
 by smtp.googlemail.com with ESMTPSA id
 d2-v6sm6692589edd.55.2018.09.17.08.56.51
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 17 Sep 2018 08:56:52 -0700 (PDT)
From: 21naown@HIDDEN
X-Google-Original-From: 21Naown@HIDDEN
Subject: Re: bug#32704: Can grep search for a line feed and a null character
 at the same time?
To: 32704 <at> debbugs.gnu.org, Assaf Gordon <assafgordon@HIDDEN>,
 Eric Blake <eblake@HIDDEN>, Paul Eggert <eggert@HIDDEN>
References: <7c837f78-a794-94e7-0562-bc768b0213ac@HIDDEN>
 <f6d5340c-5e7c-d299-af8b-a2751b49eb52@HIDDEN>
 <a79681fb-9aa7-6a27-010d-e8582e7ed5cc@HIDDEN>
 <fd8f5f0e-79eb-351f-dd28-31fd4b23c57b@HIDDEN>
 <7b844c92-d352-c8d5-6d55-a27246dcbdbf@HIDDEN>
 <be2e1860-d6f8-b54c-3b3d-bff59d0d67cb@HIDDEN>
 <9715a94b-5173-df57-1991-76e3a75c2362@HIDDEN>
 <31e7f84e-eac8-8f63-fe94-b46071bf6c74@HIDDEN>
Message-ID: <e7676fa5-fe29-37f5-655f-c95259d6af3e@HIDDEN>
Date: Mon, 17 Sep 2018 17:56:52 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <31e7f84e-eac8-8f63-fe94-b46071bf6c74@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-GB
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 32704
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello Assaf.

Thank you Assaf and Eric for your suggestions. I will also look at the 
tool “pcregrep”.

--------------------------------------------------------------------------------

Thank you Eric for having answered the question of the subject:

Le 15/09/2018 à 22:27, Eric Blake a écrit :
> On 9/15/18 12:57 PM, 21naown@HIDDEN wrote:
>
>> So it is possible to find “\x0A\x00” alone, but for example 
>> “\x74\x00\x0D\x00\x0A\x00\x74\x00\x65\00” is impossible to find with 
>> the “-P” option?
>
> Correct. It is impossible to find the record terminator in the middle 
> of a pattern, whether that terminator is \n (default) or NUL (-z).  It 
> is therefore impossible to find a multi-record match using grep.  The 
> string you listed contains both \x00 and \x0a, so regardless of which 
> of those two bytes you pick as the record terminator, it is impossible 
> to use grep to find that substring in your file.  You'll have to 
> resort to a tool that supports multiline matching, since grep is not 
> such a tool.




Information forwarded to bug-grep@HIDDEN:
bug#32704; Package grep. Full text available.

Message received at 32704 <at> debbugs.gnu.org:


Received: (at 32704) by debbugs.gnu.org; 15 Sep 2018 20:27:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 15 16:27:19 2018
Received: from localhost ([127.0.0.1]:41791 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g1H9z-0006Wf-1L
	for submit <at> debbugs.gnu.org; Sat, 15 Sep 2018 16:27:19 -0400
Received: from mx1.redhat.com ([209.132.183.28]:34218)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eblake@HIDDEN>) id 1g1H9w-0006WS-9z
 for 32704 <at> debbugs.gnu.org; Sat, 15 Sep 2018 16:27:16 -0400
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com
 [10.5.11.23])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id 5C2093082137;
 Sat, 15 Sep 2018 20:27:10 +0000 (UTC)
Received: from [10.10.122.46] (ovpn-122-46.rdu2.redhat.com [10.10.122.46])
 by smtp.corp.redhat.com (Postfix) with ESMTP id B29F44505;
 Sat, 15 Sep 2018 20:27:09 +0000 (UTC)
Subject: Re: bug#32704: Can grep search for a line feed and a null character
 at the same time?
To: 21naown@HIDDEN, 32704 <at> debbugs.gnu.org, Paul Eggert <eggert@HIDDEN>
References: <7c837f78-a794-94e7-0562-bc768b0213ac@HIDDEN>
 <f6d5340c-5e7c-d299-af8b-a2751b49eb52@HIDDEN>
 <a79681fb-9aa7-6a27-010d-e8582e7ed5cc@HIDDEN>
 <fd8f5f0e-79eb-351f-dd28-31fd4b23c57b@HIDDEN>
 <7b844c92-d352-c8d5-6d55-a27246dcbdbf@HIDDEN>
 <be2e1860-d6f8-b54c-3b3d-bff59d0d67cb@HIDDEN>
 <9715a94b-5173-df57-1991-76e3a75c2362@HIDDEN>
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
Message-ID: <31e7f84e-eac8-8f63-fe94-b46071bf6c74@HIDDEN>
Date: Sat, 15 Sep 2018 15:27:08 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.0
MIME-Version: 1.0
In-Reply-To: <9715a94b-5173-df57-1991-76e3a75c2362@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.42]); Sat, 15 Sep 2018 20:27:10 +0000 (UTC)
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 32704
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

On 9/15/18 12:57 PM, 21naown@HIDDEN wrote:

>>> But is it at least possible to find “\x0A\x00” with grep?
>>
>> If you bend the rules by throwing -P into the mix, yes :)
>>
> So it is possible to find “\x0A\x00” alone, but for example 
> “\x74\x00\x0D\x00\x0A\x00\x74\x00\x65\00” is impossible to find with the 
> “-P” option?

Correct. It is impossible to find the record terminator in the middle of 
a pattern, whether that terminator is \n (default) or NUL (-z).  It is 
therefore impossible to find a multi-record match using grep.  The 
string you listed contains both \x00 and \x0a, so regardless of which of 
those two bytes you pick as the record terminator, it is impossible to 
use grep to find that substring in your file.  You'll have to resort to 
a tool that supports multiline matching, since grep is not such a tool.

It IS possible, of course, to change your data, for example:

tr '\0' '\xff' < file | grep $modified_pattern | tr '\xff' '\0'

assuming that \xff didn't appear anywhere else in the file; although it 
may make matching harder if you don't have the right record terminators 
any longer.  Or, if your input data is encoded in UTF-16, it's easiest 
to convert it into UTF-8 for the grep:

iconv -f UTF-16 -t UTF-8 < file | grep $modified_pattern \
   | iconv -f UTF-8 -t UTF-16

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




Information forwarded to bug-grep@HIDDEN:
bug#32704; Package grep. Full text available.

Message received at 32704 <at> debbugs.gnu.org:


Received: (at 32704) by debbugs.gnu.org; 15 Sep 2018 20:20:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 15 16:20:51 2018
Received: from localhost ([127.0.0.1]:41787 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g1H3j-0006MD-25
	for submit <at> debbugs.gnu.org; Sat, 15 Sep 2018 16:20:51 -0400
Received: from mail-io1-f49.google.com ([209.85.166.49]:44223)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <assafgordon@HIDDEN>) id 1g1H3h-0006Lu-IJ
 for 32704 <at> debbugs.gnu.org; Sat, 15 Sep 2018 16:20:49 -0400
Received: by mail-io1-f49.google.com with SMTP id 75-v6so8584143iou.11
 for <32704 <at> debbugs.gnu.org>; Sat, 15 Sep 2018 13:20:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-language:content-transfer-encoding;
 bh=+9wr3DsmjiAZkbvuZACDutpjV4LLBlM9dz52FEWf7Cg=;
 b=P06xutwhF8a98q8bitzjZ6nu96jHGN1CqN8yIuSkX6Fu821suy0Gi1kjFZQXfIXrDJ
 PA9owR22MlmR7uMA9Q8tte9V9HTa88Ui14Bffa4UJ2K9p0ii/WyYY+ikWv2nYh4GfBk4
 UXlWnNO3cc5GPHKWGxyYzLOcrluV6k+3IEX4guxt6wbzdxjHOPnQQFlaQRckO7OR4U5G
 HGYH7Yrx+KDXYVgC4wzdgKlFbLKq7XUDMsa5jYHTl8ohwftGDz7FLWn9Gc3ciEBELksP
 gDG1KtTtt5nApuW4M+4aZccNhfLhC+Bw2SfiZnjrv7PiI1sa2/TzL9wzdegk9kIyjqYn
 SLHQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=+9wr3DsmjiAZkbvuZACDutpjV4LLBlM9dz52FEWf7Cg=;
 b=XjMUvePsxcpmzG6lLEaFTP7+tMWN7jdTe+JcvQOvyhItiWkTCIbiF8oyoyktYatOoq
 RjYOhTrd8AsFq8xsL0E0U+ECxNTiNg7cpjRoh82jfEgIiSXkxDb89RjuH6bm1TEZOIuP
 W3udz1rDucZYprj5GJ6ayc0F1u2u0qEW4LOOk7Ol5EPAwUySvG6pg+tyK83Q9aBFn+HM
 BYujXi222nmdohRmYXzJ1avTPaJiPOuB9EYp3BVsYMZOX5QyB6w01qFtllLTLPyCi6UP
 WZzGuB3VltTjbx4axKNi4chsAQ9re0ntQIxZ46RmJ7TPt/cRYNDwlS+rkliT/tNohraK
 WHRQ==
X-Gm-Message-State: APzg51Cbzpbn1w/knZSPnhKIFr+VLqEZbGejYaCk/rUJMj3G9rq1e/vL
 d1soKnpIyGtuD+qHaYDKcSc=
X-Google-Smtp-Source: ANB0VdbvNzBQCafxTeHqCddoRcYp87xbMuEQzdooMEtlPlGzYkbwAUIxPgQoVJr/YG6SX0DfrpSyKA==
X-Received: by 2002:a6b:6b05:: with SMTP id
 g5-v6mr8876405ioc.256.1537042843715; 
 Sat, 15 Sep 2018 13:20:43 -0700 (PDT)
Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38])
 by smtp.googlemail.com with ESMTPSA id
 p130-v6sm1219572itd.22.2018.09.15.13.20.41
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 15 Sep 2018 13:20:42 -0700 (PDT)
Subject: Re: bug#32704: Can grep search for a line feed and a null character
 at the same time?
To: 21naown@HIDDEN, 32704 <at> debbugs.gnu.org, Eric Blake <eblake@HIDDEN>, 
 Paul Eggert <eggert@HIDDEN>
References: <7c837f78-a794-94e7-0562-bc768b0213ac@HIDDEN>
 <f6d5340c-5e7c-d299-af8b-a2751b49eb52@HIDDEN>
 <a79681fb-9aa7-6a27-010d-e8582e7ed5cc@HIDDEN>
 <fd8f5f0e-79eb-351f-dd28-31fd4b23c57b@HIDDEN>
 <7b844c92-d352-c8d5-6d55-a27246dcbdbf@HIDDEN>
 <be2e1860-d6f8-b54c-3b3d-bff59d0d67cb@HIDDEN>
 <9715a94b-5173-df57-1991-76e3a75c2362@HIDDEN>
From: Assaf Gordon <assafgordon@HIDDEN>
Message-ID: <cbf68adb-590f-0a41-10c0-7702bb9a4e47@HIDDEN>
Date: Sat, 15 Sep 2018 14:20:40 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <9715a94b-5173-df57-1991-76e3a75c2362@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 32704
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

On 15/09/18 11:57 AM, 21naown@HIDDEN wrote:
> Le 15/09/2018 à 19:06, Eric Blake a écrit :
>> On 9/15/18 11:43 AM, 21naown@HIDDEN wrote:
>>> But is it at least possible to find “\x0A\x00” with grep?
>>
>> If you bend the rules by throwing -P into the mix, yes :)
>>
> So it is possible to find “\x0A\x00” alone, but for example 
> “\x74\x00\x0D\x00\x0A\x00\x74\x00\x65\00” is impossible to find with the 
> “-P” option?

If I may suggest a different tool, GNU sed can handle such regexes more 
easily than grep.
The 'trick' is to accumulate multiple lines into memory, then run the
regex on the entire buffer.

1.
If you input is small enough to fit in memory,
you can load the entire file into memory,
and run the regex on the buffer:

$ printf 
'\xFF\xFE\x0D\x00\x0A\x00\x74\x00\x65\x00\x73\x00\x74\x00\x0D\x00\x0A\x00\x74\x00\x65\x00\x73\x00\x74\x00\x5F\x00\x74\x00\x77\x00\x6F\x00\x0D\x00\x0A\x00' 
\
      | LC_ALL=C sed -n 'H;$!d ; x ; /\x0a\x00/q0 ; q1' \
            && echo MATCH || echo NO-MATCH

The "H;$!d" commands accumulate lines into the hold buffer.
The "x" command copies the hold buffer into the pattern buffer.
Then the regex "/\x0a\x00/" searches in the buffer.
If there was a match, sed quits with exit code 0 ("q0").
Otherwise, sed quits with exit code 1 ("q1").


2.
If the file is too big to fit in memory,
you can process it line-by-line like so:

$ printf 
'\xFF\xFE\x0D\x00\x0A\x00\x74\x00\x65\x00\x73\x00\x74\x00\x0D\x00\x0A\x00\x74\x00\x65\x00\x73\x00\x74\x00\x5F\x00\x74\x00\x77\x00\x6F\x00\x0D\x00\x0A\x00' 
\
      | LC_ALL=C sed -n 'N;/\x00\x0a/q0;$q1;D;' \
              && echo MATCH || echo NO-MATCH

The N,D commands work in tandem to append the next line into the
buffer, then delete the last line from the buffer (think FIFO).
The regex then operates on the buffer which contains the last two lines.



More details are in the manual:
  https://www.gnu.org/software/sed/manual/sed.html#Multiline-techniques
https://www.gnu.org/software/sed/manual/sed.html#Text-search-across-multiple-lines



regards,
  - assaf





Information forwarded to bug-grep@HIDDEN:
bug#32704; Package grep. Full text available.

Message received at 32704 <at> debbugs.gnu.org:


Received: (at 32704) by debbugs.gnu.org; 15 Sep 2018 17:57:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 15 13:57:29 2018
Received: from localhost ([127.0.0.1]:41761 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g1Eoz-0002jh-Lw
	for submit <at> debbugs.gnu.org; Sat, 15 Sep 2018 13:57:29 -0400
Received: from mail-wm1-f50.google.com ([209.85.128.50]:37310)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <21naown@HIDDEN>) id 1g1Eoy-0002jV-Ao
 for 32704 <at> debbugs.gnu.org; Sat, 15 Sep 2018 13:57:28 -0400
Received: by mail-wm1-f50.google.com with SMTP id n11-v6so5177625wmc.2
 for <32704 <at> debbugs.gnu.org>; Sat, 15 Sep 2018 10:57:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:subject:to:references:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding:content-language;
 bh=yK8jn4TqF+CQuwUDhzBnrpyAHvlvHU/oX0y+JFHiuDk=;
 b=UGb0x/vxX+jaKNI4X5zco31ylkx31GqgVMZGZpnPwAJV2hd0DAQ5jG/KGzkwXbC52X
 4tbO+B4c+I3XV+KsIr16KNyni1JPYR0fjYTkVa1AY8G8wrLp3NAnmCGPVkj0VA/NL13A
 aw4U4rP1qR81HHAog1nnYvTdOOKNLRInhyH3cieHnAotOn+uZJvGIfAFh6JYcTEoCKUo
 fRiDH3qpw5sW97NIcnm4S6sGoWLIXyn7ZSt2MUBB5qtycU7s5RoM7TsNJVFwLEBXFWHZ
 OozC0fDXLYsBO6eeR4n/2BjFO5dcED2Zk6qXfhziJ0YGK9GGAb+N+kXnBq2Jvquk6BQm
 wUGg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:subject:to:references:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding
 :content-language;
 bh=yK8jn4TqF+CQuwUDhzBnrpyAHvlvHU/oX0y+JFHiuDk=;
 b=qHHXnfhObVsnpFfTs5MNogx97C+NdTzqtbfAYw3PRxyzBrt8rRKvy+thZ++wQ2rirj
 DmutC+p62lKbGvkzJR686b5J7lAbROHwbMOfsuJ/TYWRfz9wNCkK0HyU2/s2lxZEA4oc
 8ysY/+n30bF7WV/rqnuZJ729piGkm5QxSc3OzQIcQ4ViJwQQjOnnajgXveGGsXPCGZ5T
 1gCIdueuE1LpMHUy9Ct1GQjDFnsFYCyvHhPjvPwZ04zz8xPKf6KqkxZkmOjm83cnPKrS
 Ie733RTfl/9HQTiNtpmQmDfp8peuQjMgA69DXImS7H2PIj9GkAGSrQEbv7ENXfhvObS5
 q4vQ==
X-Gm-Message-State: APzg51CSWD0SHjRprrn8XRnBhVJL24T8EbavFJdQadzhyHht/xGtwxZ4
 2m8DmaZzkjVz/Eb4Db3ruEc=
X-Google-Smtp-Source: ANB0VdZX9b4ICnsVSMPnu0C6OSaQ9t+ImTb7IeQICNDXBXaj+yqQ6LNhiwH+VlZ3Cc/Owdaj7+O2mQ==
X-Received: by 2002:a1c:938a:: with SMTP id
 v132-v6mr5762290wmd.114.1537034242449; 
 Sat, 15 Sep 2018 10:57:22 -0700 (PDT)
Received: from [192.168.1.2] (152.232.12.109.rev.sfr.net. [109.12.232.152])
 by smtp.googlemail.com with ESMTPSA id 1-v6sm5691302wmf.47.2018.09.15.10.57.21
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 15 Sep 2018 10:57:22 -0700 (PDT)
From: 21naown@HIDDEN
X-Google-Original-From: 21Naown@HIDDEN
Subject: Re: bug#32704: Can grep search for a line feed and a null character
 at the same time?
To: 32704 <at> debbugs.gnu.org, Eric Blake <eblake@HIDDEN>,
 Paul Eggert <eggert@HIDDEN>
References: <7c837f78-a794-94e7-0562-bc768b0213ac@HIDDEN>
 <f6d5340c-5e7c-d299-af8b-a2751b49eb52@HIDDEN>
 <a79681fb-9aa7-6a27-010d-e8582e7ed5cc@HIDDEN>
 <fd8f5f0e-79eb-351f-dd28-31fd4b23c57b@HIDDEN>
 <7b844c92-d352-c8d5-6d55-a27246dcbdbf@HIDDEN>
 <be2e1860-d6f8-b54c-3b3d-bff59d0d67cb@HIDDEN>
Message-ID: <9715a94b-5173-df57-1991-76e3a75c2362@HIDDEN>
Date: Sat, 15 Sep 2018 19:57:24 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <be2e1860-d6f8-b54c-3b3d-bff59d0d67cb@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-GB
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 32704
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Le 15/09/2018 à 19:06, Eric Blake a écrit :
> On 9/15/18 11:43 AM, 21naown@HIDDEN wrote:
>> Thank you for your messages.
>>
>> It is possible I did not understand correctly your messages, because 
>> grep finds hex sequences with the “-Pa” options at least.
>
> grep -P introduces a completely different regex engine, with its own 
> quirks.  As such, it does introduce different rules on backslash 
> sequences accepted.
>
>>
>> Examples—“input.txt” contains, from the file system, for example 
>> “\xFF\xFE\x0D\x00\x0A\x00\x74\x00\x65\x00\x73\x00\x74\x00\x0D\x00\x0A\x00\x74\x00\x65\x00\x73\x00\x74\x00\x5F\x00\x74\x00\x77\x00\x6F\x00\x0D\x00\x0A\x00”: 
>>
>> grep -Pa '\x00' input.txt
>> → found
>> grep -Pza '\x0A' input.txt
>> → found
>> grep -Pa '\x0A\x00' input.txt
>
> This will never match - when you are not using -z, there are no \x0A 
> in the input stream (they have all been consumed by grep parsing one 
> line at a time, ending at \x0A).  Instead, you'll want to search for 
> '^\x00' or '\x00$' for a pattern anchored to a line transition, to 
> find patterns where newline was next to NUL.
>
>> grep -Pza '\x0A\x00' input.txt
>> → not found for the both
>
> Similarly, when you are using -z, there are no \x00 in the input 
> stream (they  have all been consumed by grep parsing one 
> NUL-terminated record at a time, ending at \x00).  Instead, you'll 
> want to search for '^\x0a' or '\x0a$' for a pattern anchored to a 
> record transition, to find patterns where newline was next to NUL.
>
>>
>> But is it at least possible to find “\x0A\x00” with grep?
>
> If you bend the rules by throwing -P into the mix, yes :)
>
So it is possible to find “\x0A\x00” alone, but for example 
“\x74\x00\x0D\x00\x0A\x00\x74\x00\x65\00” is impossible to find with the 
“-P” option?




Information forwarded to bug-grep@HIDDEN:
bug#32704; Package grep. Full text available.

Message received at 32704 <at> debbugs.gnu.org:


Received: (at 32704) by debbugs.gnu.org; 15 Sep 2018 17:43:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 15 13:43:21 2018
Received: from localhost ([127.0.0.1]:41757 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g1EbJ-0002P9-6K
	for submit <at> debbugs.gnu.org; Sat, 15 Sep 2018 13:43:21 -0400
Received: from mail-ed1-f52.google.com ([209.85.208.52]:42112)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <21naown@HIDDEN>) id 1g1Dfg-0000vK-1K
 for 32704 <at> debbugs.gnu.org; Sat, 15 Sep 2018 12:43:48 -0400
Received: by mail-ed1-f52.google.com with SMTP id l5so9733446edw.9
 for <32704 <at> debbugs.gnu.org>; Sat, 15 Sep 2018 09:43:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:subject:to:references:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding:content-language;
 bh=cl4y83Cezqr1cEY5qmAwLmRf80uhZNBnfQvmKC3czGk=;
 b=ihxoW/wRLx3AP46YRlGrnq+uIM+edWBt1Nv0yQH/8TNsmSQgDbvmSeCOm0V5f8GZo3
 a5ftig228Sda1POTzAfRGzEm1trvbJ7rIZhkUymkP9+SQHUDtKljmczB37IiA9UA4W13
 vPHbdBBESQiF5znIn4dYbR79ypdtCByfYtV1ukQtsFNHVkcheaV3k1wwUc/qejf1ZbeY
 x6Lg02pFXD48nfixAtzXaAr0G7R+SOnpvjr5o21b34kyWkiqjSvCbcpvcX7YYKWWP9su
 GzCEChwdR74/LC9xi//7JXbMxhTs6RwbE1AWUMvvq2D0pRmSLgoZorIDAAg/9VDdxe1Y
 03Sg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:subject:to:references:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding
 :content-language;
 bh=cl4y83Cezqr1cEY5qmAwLmRf80uhZNBnfQvmKC3czGk=;
 b=tpqihwJNB5B2Mj0IjwFnhYY77dzwggDtoeEkzVoaDmwR9B3EOiENFZG8G1fZlEGGIL
 1YnR8PxN+PaW3fQ69HKLE3u+bGruQc6HjcPwCfQN3u1uZASciOLomdiDwn6BRjoec2Bq
 OZ6M0tFV2qnqrIxMowAKe4jRGlE/yIwNHb2Tjez1ihSqA7Hm3VbLLhCbBrNLuKWeW8i4
 uUMHELZD1Yy7o8brl65BL1CDnBZrtbfe+vJQmvQ4nkJS33hF51KOwAq/pL+rltKU3os/
 BvSsZwxA4wBPVxDU6WR9L99Awpuq7DbJE/seFcAjO/9VUKyuGGKBnDA8xHa06jC/mQRZ
 UPAw==
X-Gm-Message-State: APzg51D3c92uuwaPxhSuGsbn48fG+VrRd0WtFH5y8O22HA8YhIIeZvjX
 5MEIwzmTE8AhiE8YPUzMGoI=
X-Google-Smtp-Source: ANB0VdbekQmKtUQpT5NEKpAYF2ePck0w9KtI0gyC+mAKEth8VTRr2i09F0WYFvEuBhsPDEL/Nuct0g==
X-Received: by 2002:a50:bc03:: with SMTP id
 j3-v6mr30220457edh.34.1537029822249; 
 Sat, 15 Sep 2018 09:43:42 -0700 (PDT)
Received: from [192.168.1.2] (152.232.12.109.rev.sfr.net. [109.12.232.152])
 by smtp.googlemail.com with ESMTPSA id
 h3-v6sm5034792ede.42.2018.09.15.09.43.41
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 15 Sep 2018 09:43:41 -0700 (PDT)
From: 21naown@HIDDEN
X-Google-Original-From: 21Naown@HIDDEN
Subject: Re: bug#32704: Can grep search for a line feed and a null character
 at the same time?
To: 32704 <at> debbugs.gnu.org, Eric Blake <eblake@HIDDEN>,
 Paul Eggert <eggert@HIDDEN>
References: <7c837f78-a794-94e7-0562-bc768b0213ac@HIDDEN>
 <f6d5340c-5e7c-d299-af8b-a2751b49eb52@HIDDEN>
 <a79681fb-9aa7-6a27-010d-e8582e7ed5cc@HIDDEN>
 <fd8f5f0e-79eb-351f-dd28-31fd4b23c57b@HIDDEN>
Message-ID: <7b844c92-d352-c8d5-6d55-a27246dcbdbf@HIDDEN>
Date: Sat, 15 Sep 2018 18:43:44 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <fd8f5f0e-79eb-351f-dd28-31fd4b23c57b@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-GB
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 32704
X-Mailman-Approved-At: Sat, 15 Sep 2018 13:43:19 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Thank you for your messages.

It is possible I did not understand correctly your messages, because 
grep finds hex sequences with the “-Pa” options at least.

Examples—“input.txt” contains, from the file system, for example 
“\xFF\xFE\x0D\x00\x0A\x00\x74\x00\x65\x00\x73\x00\x74\x00\x0D\x00\x0A\x00\x74\x00\x65\x00\x73\x00\x74\x00\x5F\x00\x74\x00\x77\x00\x6F\x00\x0D\x00\x0A\x00”:
grep -Pa '\x00' input.txt
→ found
grep -Pza '\x0A' input.txt
→ found
grep -Pa '\x0A\x00' input.txt
grep -Pza '\x0A\x00' input.txt
→ not found for the both

But is it at least possible to find “\x0A\x00” with grep?




Information forwarded to bug-grep@HIDDEN:
bug#32704; Package grep. Full text available.

Message received at 32704 <at> debbugs.gnu.org:


Received: (at 32704) by debbugs.gnu.org; 15 Sep 2018 17:06:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 15 13:06:56 2018
Received: from localhost ([127.0.0.1]:41751 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g1E24-0001VW-6W
	for submit <at> debbugs.gnu.org; Sat, 15 Sep 2018 13:06:56 -0400
Received: from mx1.redhat.com ([209.132.183.28]:45030)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eblake@HIDDEN>) id 1g1E22-0001VK-Dj
 for 32704 <at> debbugs.gnu.org; Sat, 15 Sep 2018 13:06:54 -0400
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com
 [10.5.11.15])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id B592C3082144;
 Sat, 15 Sep 2018 17:06:48 +0000 (UTC)
Received: from [10.10.122.46] (ovpn-122-46.rdu2.redhat.com [10.10.122.46])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 15E17703BB;
 Sat, 15 Sep 2018 17:06:47 +0000 (UTC)
Subject: Re: bug#32704: Can grep search for a line feed and a null character
 at the same time?
To: 21naown@HIDDEN, 32704 <at> debbugs.gnu.org, Paul Eggert <eggert@HIDDEN>
References: <7c837f78-a794-94e7-0562-bc768b0213ac@HIDDEN>
 <f6d5340c-5e7c-d299-af8b-a2751b49eb52@HIDDEN>
 <a79681fb-9aa7-6a27-010d-e8582e7ed5cc@HIDDEN>
 <fd8f5f0e-79eb-351f-dd28-31fd4b23c57b@HIDDEN>
 <7b844c92-d352-c8d5-6d55-a27246dcbdbf@HIDDEN>
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
Message-ID: <be2e1860-d6f8-b54c-3b3d-bff59d0d67cb@HIDDEN>
Date: Sat, 15 Sep 2018 12:06:47 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.0
MIME-Version: 1.0
In-Reply-To: <7b844c92-d352-c8d5-6d55-a27246dcbdbf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.42]); Sat, 15 Sep 2018 17:06:48 +0000 (UTC)
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 32704
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

On 9/15/18 11:43 AM, 21naown@HIDDEN wrote:
> Thank you for your messages.
> 
> It is possible I did not understand correctly your messages, because 
> grep finds hex sequences with the “-Pa” options at least.

grep -P introduces a completely different regex engine, with its own 
quirks.  As such, it does introduce different rules on backslash 
sequences accepted.

> 
> Examples—“input.txt” contains, from the file system, for example 
> “\xFF\xFE\x0D\x00\x0A\x00\x74\x00\x65\x00\x73\x00\x74\x00\x0D\x00\x0A\x00\x74\x00\x65\x00\x73\x00\x74\x00\x5F\x00\x74\x00\x77\x00\x6F\x00\x0D\x00\x0A\x00”: 
> 
> grep -Pa '\x00' input.txt
> → found
> grep -Pza '\x0A' input.txt
> → found
> grep -Pa '\x0A\x00' input.txt

This will never match - when you are not using -z, there are no \x0A in 
the input stream (they have all been consumed by grep parsing one line 
at a time, ending at \x0A).  Instead, you'll want to search for '^\x00' 
or '\x00$' for a pattern anchored to a line transition, to find patterns 
where newline was next to NUL.

> grep -Pza '\x0A\x00' input.txt
> → not found for the both

Similarly, when you are using -z, there are no \x00 in the input stream 
(they  have all been consumed by grep parsing one NUL-terminated record 
at a time, ending at \x00).  Instead, you'll want to search for '^\x0a' 
or '\x0a$' for a pattern anchored to a record transition, to find 
patterns where newline was next to NUL.

> 
> But is it at least possible to find “\x0A\x00” with grep?

If you bend the rules by throwing -P into the mix, yes :)

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




Information forwarded to bug-grep@HIDDEN:
bug#32704; Package grep. Full text available.

Message received at 32704 <at> debbugs.gnu.org:


Received: (at 32704) by debbugs.gnu.org; 11 Sep 2018 17:40:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 11 13:40:02 2018
Received: from localhost ([127.0.0.1]:37336 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fzmdu-0001jV-D0
	for submit <at> debbugs.gnu.org; Tue, 11 Sep 2018 13:40:02 -0400
Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56812 helo=mx1.redhat.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eblake@HIDDEN>) id 1fzmds-0001iy-JJ
 for 32704 <at> debbugs.gnu.org; Tue, 11 Sep 2018 13:40:01 -0400
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
 [10.11.54.6])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id 2899F4023337;
 Tue, 11 Sep 2018 17:39:55 +0000 (UTC)
Received: from [10.10.122.46] (ovpn-122-46.rdu2.redhat.com [10.10.122.46])
 by smtp.corp.redhat.com (Postfix) with ESMTP id B96B72157F49;
 Tue, 11 Sep 2018 17:39:54 +0000 (UTC)
Subject: Re: bug#32704: Can grep search for a line feed and a null character
 at the same time?
To: Paul Eggert <eggert@HIDDEN>, 21naown@HIDDEN, 32704 <at> debbugs.gnu.org
References: <7c837f78-a794-94e7-0562-bc768b0213ac@HIDDEN>
 <f6d5340c-5e7c-d299-af8b-a2751b49eb52@HIDDEN>
 <a79681fb-9aa7-6a27-010d-e8582e7ed5cc@HIDDEN>
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
Message-ID: <fd8f5f0e-79eb-351f-dd28-31fd4b23c57b@HIDDEN>
Date: Tue, 11 Sep 2018 12:39:54 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.0
MIME-Version: 1.0
In-Reply-To: <a79681fb-9aa7-6a27-010d-e8582e7ed5cc@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.11.55.6]); Tue, 11 Sep 2018 17:39:55 +0000 (UTC)
X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]);
 Tue, 11 Sep 2018 17:39:55 +0000 (UTC) for IP:'10.11.54.6'
 DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com'
 HELO:'smtp.corp.redhat.com' FROM:'eblake@HIDDEN' RCPT:''
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 32704
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

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




Information forwarded to bug-grep@HIDDEN:
bug#32704; Package grep. Full text available.

Message received at 32704 <at> debbugs.gnu.org:


Received: (at 32704) by debbugs.gnu.org; 11 Sep 2018 17:15:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 11 13:15:01 2018
Received: from localhost ([127.0.0.1]:37323 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fzmFh-000162-0q
	for submit <at> debbugs.gnu.org; Tue, 11 Sep 2018 13:15:01 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:34084)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1fzmFf-00015k-0q
 for 32704 <at> debbugs.gnu.org; Tue, 11 Sep 2018 13:14:59 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id DFE031616F0;
 Tue, 11 Sep 2018 10:14:52 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id 2DnU9LE8Kuwq; Tue, 11 Sep 2018 10:14:52 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 37A901616F1;
 Tue, 11 Sep 2018 10:14:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id rL6WRVoI88Xn; Tue, 11 Sep 2018 10:14:52 -0700 (PDT)
Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 1C9261616F0;
 Tue, 11 Sep 2018 10:14:52 -0700 (PDT)
Subject: Re: bug#32704: Can grep search for a line feed and a null character
 at the same time?
To: Eric Blake <eblake@HIDDEN>, 21naown@HIDDEN, 32704 <at> debbugs.gnu.org
References: <7c837f78-a794-94e7-0562-bc768b0213ac@HIDDEN>
 <f6d5340c-5e7c-d299-af8b-a2751b49eb52@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Openpgp: preference=signencrypt
Autocrypt: addr=eggert@HIDDEN; prefer-encrypt=mutual; keydata=
 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
 uNcby4U=
Organization: UCLA Computer Science Department
Message-ID: <a79681fb-9aa7-6a27-010d-e8582e7ed5cc@HIDDEN>
Date: Tue, 11 Sep 2018 10:14:51 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.0
MIME-Version: 1.0
In-Reply-To: <f6d5340c-5e7c-d299-af8b-a2751b49eb52@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 32704
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

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.





Information forwarded to bug-grep@HIDDEN:
bug#32704; Package grep. Full text available.

Message received at 32704 <at> debbugs.gnu.org:


Received: (at 32704) by debbugs.gnu.org; 11 Sep 2018 17:03:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 11 13:03:25 2018
Received: from localhost ([127.0.0.1]:37305 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fzm4T-0000nq-A2
	for submit <at> debbugs.gnu.org; Tue, 11 Sep 2018 13:03:25 -0400
Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42328 helo=mx1.redhat.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eblake@HIDDEN>) id 1fzm4R-0000nb-Ba
 for 32704 <at> debbugs.gnu.org; Tue, 11 Sep 2018 13:03:23 -0400
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
 [10.11.54.4])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id D400D40216E5;
 Tue, 11 Sep 2018 17:03:17 +0000 (UTC)
Received: from [10.10.122.46] (ovpn-122-46.rdu2.redhat.com [10.10.122.46])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 919552016F06;
 Tue, 11 Sep 2018 17:03:17 +0000 (UTC)
Subject: Re: bug#32704: Can grep search for a line feed and a null character
 at the same time?
To: 21naown@HIDDEN, 32704 <at> debbugs.gnu.org
References: <7c837f78-a794-94e7-0562-bc768b0213ac@HIDDEN>
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
Message-ID: <f6d5340c-5e7c-d299-af8b-a2751b49eb52@HIDDEN>
Date: Tue, 11 Sep 2018 12:03:17 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.0
MIME-Version: 1.0
In-Reply-To: <7c837f78-a794-94e7-0562-bc768b0213ac@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.11.55.5]); Tue, 11 Sep 2018 17:03:17 +0000 (UTC)
X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]);
 Tue, 11 Sep 2018 17:03:17 +0000 (UTC) for IP:'10.11.54.4'
 DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com'
 HELO:'smtp.corp.redhat.com' FROM:'eblake@HIDDEN' RCPT:''
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 32704
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

On 9/11/18 11:25 AM, 21naown@HIDDEN wrote:
> Hello,
> 
> 
> I found someone who asked the same question on “Stack Overflow”, still 
> unanswered, but this person did not ask it on the mailing list.
> 
> Here are the details of the question which are nearly similar to my case:
> https://stackoverflow.com/questions/50295772/can-grep-search-for-a-line-feed-and-a-null-character-at-the-same-time 

Per 'info grep':

   15. How can I match across lines?

      Standard grep cannot do this, as it is fundamentally line-based.
      Therefore, merely using the ‘[:space:]’ character class does not
      match newlines in the way you might expect.

      With the GNU ‘grep’ option ‘-z’ (‘--null-data’), each input and
      output “line” is null-terminated; *note Other Options::.  Thus, you
      can match newlines in the input, but typically if there is a match
      the entire input is output, so this usage is often combined with
      output-suppressing options like ‘-q’, e.g.:

           printf 'foo\nbar\n' | grep -z -q 'foo[[:space:]]\+bar'

      If this does not suffice, you can transform the input before giving
      it to ‘grep’, or turn to ‘awk’, ‘sed’, ‘perl’, or many other
      utilities that are designed to operate across lines.

Grep does not have the ability to match hex or octal backslash 
sequences, and a literal newline in the pattern is taken as a separation 
of patterns.  Use of [:space:] to include newline alongside other things 
sort of works.  But 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 (and thus expressing 
a literal newline, as in shells that understand $'\n$', to be viable for 
writing a single pattern that matches exactly one newline byte at the 
end of a NUL-separated record).

That said, your EASIEST approach is to use iconv to recode your file out 
of UTF-16 (which is NOT conducive to multi-byte processing), into 
something friendlier like UTF-8, and then use grep on the converted file.

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




Information forwarded to bug-grep@HIDDEN:
bug#32704; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Sep 2018 16:26:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 11 12:26:55 2018
Received: from localhost ([127.0.0.1]:37294 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fzlV9-0008Jm-0Y
	for submit <at> debbugs.gnu.org; Tue, 11 Sep 2018 12:26:55 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48954)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <21naown@HIDDEN>) id 1fzlTu-0008He-HY
 for submit <at> debbugs.gnu.org; Tue, 11 Sep 2018 12:25:38 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <21naown@HIDDEN>) id 1fzlTl-0006oy-Ly
 for submit <at> debbugs.gnu.org; Tue, 11 Sep 2018 12:25:31 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:44648)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <21naown@HIDDEN>) id 1fzlTk-0006lz-GD
 for submit <at> debbugs.gnu.org; Tue, 11 Sep 2018 12:25:29 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41683)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <21naown@HIDDEN>) id 1fzlTi-0007Co-Vy
 for bug-grep@HIDDEN; Tue, 11 Sep 2018 12:25:28 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <21naown@HIDDEN>) id 1fzlTf-0006bj-CM
 for bug-grep@HIDDEN; Tue, 11 Sep 2018 12:25:26 -0400
Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:41246)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <21naown@HIDDEN>) id 1fzlTf-0006aQ-2Z
 for bug-grep@HIDDEN; Tue, 11 Sep 2018 12:25:23 -0400
Received: by mail-wr1-x444.google.com with SMTP id z96-v6so26711791wrb.8
 for <bug-grep@HIDDEN>; Tue, 11 Sep 2018 09:25:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:message-id:date:user-agent:mime-version
 :content-transfer-encoding:content-language;
 bh=zsxEUMfVCstHmK6RAVd7+I9eFG+smNgfJf2yQBXoqgA=;
 b=SyMaB4TLydMG1Te6Eq1svcT/rJzdRcsWxr49yXmBrzZvAzZUhum4OvBHvWdvC/DblI
 tkS88nQ4pQO2CMNmKkc70Mf3uqQQrGZjuwN1/KgxcV8w/Pt60JWNBWmmlhDqPE4R9kcK
 PF8R2UrJU6O2C+Z3xg0JOh8rxZ0f5+1DNogEUH5hraCG3sGorLUoiXwO37moHofiVnwy
 NBqXUQcn09smDU2TPRoHqrbil/MqeznWtPVwcNx2W/h9AuSx0ms/2HvhFUNibmKOXXQh
 2u4G8Ct6xhCIqOP2vuQw2fNamx5i7mq3vx72joLe5ARw29SIN7esGFK6+1S5+lgOKYia
 5gow==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:message-id:date:user-agent
 :mime-version:content-transfer-encoding:content-language;
 bh=zsxEUMfVCstHmK6RAVd7+I9eFG+smNgfJf2yQBXoqgA=;
 b=O8ASfozsIHWw404Nh1oYqczsiQhUVBd9h6mUJOk+Uui11bw2NTgC/V6eQcHuqDKY0C
 55sH7VmQIEoyCa/4Nm+epqZU3aK1e/IC+Eio4ADk7AQSxeXUCXHL2GU1Lc8Li3+H/qM+
 pdtbDdubwErZCy+64VayVkSPcXimxYcfKZMVR9rGfEAgW2qQTUvMYkTCkKIrqN+Qiczw
 +R7L1gZg9ZWIf7pAQZOgOqfD7m2ROfeL/UtcjIb1haRoHYi7E+i0cHlKRnzXpACkDiY4
 y3lOAMWIVSFS0ZTTAlh3avvb0hxOh5udAqFFosftmS8ZvMhA8Lehy/tJx7o98GtrxteQ
 tzcQ==
X-Gm-Message-State: APzg51D8hhzflX/JJzF5jS9n1cxbKnyV1zAXPP+60oo7LgoF03NBSxWW
 ARglNgt4GLXhS/Q5u2o3vvdbdmTm
X-Google-Smtp-Source: ANB0VdaiYlb5d3IzuJVLAFgresv0KDo9MenswxH83z3itgstKpl5YC8XzxH75mg9G7sWg+aN/SgBSw==
X-Received: by 2002:adf:e44e:: with SMTP id
 t14-v6mr5260325wrm.96.1536683121264; 
 Tue, 11 Sep 2018 09:25:21 -0700 (PDT)
Received: from [192.168.1.2] (152.232.12.109.rev.sfr.net. [109.12.232.152])
 by smtp.googlemail.com with ESMTPSA id
 g2-v6sm2020061wme.20.2018.09.11.09.25.20 for <bug-grep@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 11 Sep 2018 09:25:20 -0700 (PDT)
From: 21naown@HIDDEN
X-Google-Original-From: 21Naown@HIDDEN
To: bug-grep@HIDDEN
Subject: Can grep search for a line feed and a null character at the same time?
Message-ID: <7c837f78-a794-94e7-0562-bc768b0213ac@HIDDEN>
Date: Tue, 11 Sep 2018 18:25:20 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-GB
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 11 Sep 2018 12:26:53 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Hello,


I found someone who asked the same question on “Stack Overflow”, still 
unanswered, but this person did not ask it on the mailing list.

Here are the details of the question which are nearly similar to my case:
https://stackoverflow.com/questions/50295772/can-grep-search-for-a-line-feed-and-a-null-character-at-the-same-time


Thank you for your understanding.

Best regards.





Acknowledgement sent to 21naown@HIDDEN:
New bug report received and forwarded. Copy sent to bug-grep@HIDDEN. Full text available.
Report forwarded to bug-grep@HIDDEN:
bug#32704; Package grep. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 21 Sep 2020 20:00:02 UTC

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