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.

4
  • 2
    (echo ab; echo cd) | /usr/bin/egrep -o '^.' on OpenBSD 6.2 gives a and then c so it's probably at least a macOS bug Commented Mar 5, 2018 at 18:29
  • @thrig interesting. I just tried FreeBSD 11 and your test yields a\nb\nc\nd\n. In that the grep version is 2.5.1-FreeBSD. What version does OpenBSD have? Commented Mar 5, 2018 at 19:39
  • 1
    On OpenBSD 5.8, I get a\nb\nc\nd\n (as another data point). Commented Mar 5, 2018 at 20:11
  • A related question is unix.stackexchange.com/questions/398223 . Commented Mar 6, 2018 at 8:31