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.