GNU bug report logs -
#32704
Can grep search for a line feed and a null character at the same time?
Previous Next
Full log
Message #32 received at 32704 <at> debbugs.gnu.org (full text, mbox):
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 <at> gmail.com 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.
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.