Pattern order sensitivity in grep -
I am running with grep in some very strange behavior, which I could not understand. I am trying to filter common words from a file of a word, but grep is ignoring some patterns based on my order. Here is a minimum example that shows a failure:
Test file:
Once it result from the command: Cat test.txt | Fgrep -v -w -e 'an' -e 'the' -e 'a' -e 'that' foo bar < Results from the P> command: cat test.txt | Fgrep -v -w -e 'a' -e 'a' -e 'that' -e 'the' foo once I can not find any address that grep should show such sequence sensitivity, and obviously this is a serious problem when I get to the actual information and filter lists. My suspicion is that this is actually a bug in the installed version of grep - I'm running on MacDon Mavericks, and could not reproduce this bug on Ubuntu machine.
I have answered my question: This is a bug in the version of grep that is distributed by applets. (Due to Fedorui and java10 for confirmation this is not expected behavior). Current version BSD distributed by Apple grep: 2.5.1-FreeBSD.
To resolve this problem, install GNU Grapes. I recommend doing this with alcohol:
Alcohol drinks / dhos; Install homebrews / dumps / grapes will not change native grep (which knows who can depend on), but is installed as 'ggrep', which then behaves correctly.
Comments
Post a Comment