bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23052: Make grep be able to separate output by NULL characters?


From: Paul Eggert
Subject: bug#23052: Make grep be able to separate output by NULL characters?
Date: Fri, 18 Mar 2016 09:48:25 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 03/18/2016 02:20 AM, Chiel ten Brinke wrote:
Suppose we are doing a multiline regex pattern search on a bunch of files
and we want to extract the matches, e.g. for further processing. By
default, grep outputs matches separated by newlines, but since we are doing
multiline patterns this creates the inconvenience that we cannot easily
extract the individual matches.

Thanks for pointing this out. The problem is more than just an inconvenience: grep's behavior is incorrect, since (as you mention) its output can be ambiguous. -o and -z were added separately to GNU grep, and it appears that their combination wasn't considered. I installed the attached patch to the grep master so that -z uses null bytes to terminate output lines even when -o is used.

Attachment: 0001-grep-oz-now-outputs-null-bytes-not-newlines.patch
Description: Source code patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]