--- Begin Message ---
Subject: |
input option -z alters behavior of output option -o in an undocumented way |
Date: |
Fri, 18 Nov 2016 00:16:19 -0600 |
This bug report concerns GNU grep 2.25.
Consider this file:
$ cat test
one lone
long
tone
"grep -o", according to the man page and info file, outputs "each [matched]
part on a separate output line." Given that, this command gives the expected
output:
$ grep -o one test
one
one
one
The documentation also states that -z affects only how input is interpreted.
However, adding -z makes -o no longer obey the above-quoted documentation line:
$ grep -zo one test
oneoneone
Hexdump shows that this output has ASCII NULs in place of newlines:
$ grep -zo one test | hexdump -C
00000000 6f 6e 65 00 6f 6e 65 00 6f 6e 65 00 |one.one.one.|
0000000c
Thus, -z changes the line separator used by -o. This might or might not be
desired behavior, but it is certainly not behavior that the documentation leads
one to expect. In other words, I don't know whether this is a software bug or
a documentation bug, only that the two don't agree.
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#24961: input option -z alters behavior of output option -o in an undocumented way |
Date: |
Sat, 19 Nov 2016 02:00:50 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
address@hidden wrote:
The documentation also states that -z affects only how input is interpreted.
I don't see where it does that, as the current documentation for -z talks about
both "input and output data". That being said, the manual could be clearer. I
installed the attached.
0001-grep-document-oz-better.patch
Description: Text Data
--- End Message ---