Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grep always returns "grep: conflicting matchers specified"

Tags:

grep

bash

Running on MacOSX 10.13.3 using the default terminal. When I try to use the grep command, I receive this as the output. No matter what. I've changed directories, options, and even grep alone returns the same thing. It returns:

grep: conflicting matchers specified

Recently, I was installing some new command line tools with Homebrew, and believe I ran brew install grep in the process to get the the official linux version on my computer. That's the only change I can think of that could have led to this.

Here's the trace. As you can see the grep command ran successfully, but the output was the error message instead of the results:

Command

grep -l 'this' *.txt

Trace

+ grep -GFh -l this ga_users.txt montecitovt_apache_logs-2018-02-09_21-58-40.txt tag_manager_more_than_one_ga_account.txt urls_in_sitemap.txt
grep: conflicting matchers specified
++ update_terminal_cwd
++ local url_path=
++ local i ch hexch LC_CTYPE=C LC_ALL=

...

[REDACTED]
like image 875
Josh Bradley Avatar asked Feb 26 '18 23:02

Josh Bradley


1 Answers

As you can see in the first line of the trace, the first argument grep receives is -GFh.

-G specifies regular expressions, while -F specifies fixed strings. These are of course incompatible.

It's unclear why grep would execute as grep -GFh ...., but the most likely possibility (as suggested in a comment) is probably an alias. You can verify this using alias grep, which will print whether or not grep is aliased, or type grep, which is more general (e.g. if grep is defined as a function, it will tell you that).

like image 85
Kyle Strand Avatar answered Sep 20 '22 10:09

Kyle Strand