Subject: bug#32704: Can grep search for a line feed and a null character at the same time?

From: [email-masked]
Date: Mon, 17 Sep 2018 17:56:52 +0200

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, [email-masked] 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.