I'm using grep in bash to search for the string "-1" .
I would usually search for "bar" like this ...
glaucon@foo $ grep -irn "bar"
... which works fine but when I try to search for "-1" I get this ...
glaucon@foo $ grep -irn "-1"
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
... I thought the minus might be a special character but it appears not . I also tried using the 'fixed strings' option in case this was some aspect of regex I was unfamiliar with ...
glaucon@foo $ grep -irnF "-1"
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
... but, as shown, that doesn't provide output either.
I'm sure this is straightforward but ... how ?
Thanks
grep -irn "\-1"
– schrodingerscatcuriosity Sep 12 '19 at 23:19grep
; for GNU utilities more generally, the--
end-of-options placeholder is my go-to – steeldriver Sep 12 '19 at 23:44