Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 2
    This isn’t as good an answer as you (and Cyrus) think.  It has the effect of treating the entire file as a single line.  Therefore, (1) if the file is very large, there may be a possibility of running out of memory, and (2) if the file doesn’t contain the pattern at all, then nothing will be output. And you’re right; it isn’t universally available. (But then again, --color isn’t standard either.) Commented Feb 6, 2017 at 4:43
  • What version of grep is this supported on? On grep 2.5.4, -z doesn't seem available... Commented Jun 29, 2017 at 22:29