1

I am on macOS Sierra 10.12.6

$ grep --version
grep (BSD grep) 2.5.1-FreeBSD

$ ggrep --version
ggrep (GNU grep) 3.1
Packaged by Homebrew
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

I am doing a set intersection:

BSD

$ grep -Fx --color -e '1' -e '21' <(echo 1; echo 21;)
1 # Where is the 21? Intersection of the same set should return the same set.

# -F for fixed strings
# -x to match the whole line
# --color just to make sure what was matched
# two patterns '1' then '21'. Should be a logical OR of the two patterns
# so a line matches if it matches either '1' or '21'

The input is the same as the two patterns. {1, 21}

If I flip the patterns on BSD, it works:

$ grep -Fx --color -e '21' -e '1' <(echo 1; echo 21;)
1
21

GNU

$ ggrep -Fx --color -e '1' -e '21' <(echo 1; echo 21;)
1  # works as expected
21

Is this a bug?

dosentmatter
  • 508
  • 5
  • 12

0 Answers0