I'm trying to search a directory of files for occurences of the literal string -d /data/. When I try using grep, I get an error due to the fact that -d is a grep flag:
$ grep -F "-d /data" files/* grep: invalid argument ‘ /data’ for ‘--directories’ Valid arguments are: - ‘read’ - ‘recurse’ - ‘skip’ Usage: grep [OPTION]... PATTERNS [FILE]... Try 'grep --help' for more information. This answer says to use the -F flag for grep to force it to search for a string literal, but as you can see, I already am. I've also tried fgrep and using single quotes instead of double quotes; it makes no difference. I've tried escaping the - with a backslash:
$ grep -F "\-d /data" files/* which causes grep to return zero hits even though I know for a fact that there are occurrences of -d /data to find.
How do I execute this grep search?