grep (BSD grep) 2.5.1-FreeBSD on mac os 10.8 line regexp mode not working with overlapping patterns
问题 It seems like the stock version of grep (version info: grep (BSD grep) 2.5.1-FreeBSD) under mac os 10.8 has an issue with patterns sharing a common prefix when being run in line regex mode (-x). In the following minimal example I would expect that grep reports "test" and "test2" but instead only "test" is reported. (Same also holds true for word regexp mode (-w)). printf "test\ntest2\n" > f1.txt printf "test\ntest2\n" > f2.txt grep -x -F -f f1.txt f2.txt Has anyone else made similar