After looking for solutions online I can grep for two hyphens without issue with
grep -r "\-\-" or
grep -r \\ --. But the files grep searches sometimes have lines full of hyphens, for example in comments, e.g.
/*--------- comment ----- */. I want to grep to return cases where only two hyphens are next to each other. E.g.
-- and not
---. Ideally I could use
-w but I'm not having luck with this.
And a second piece of the puzzle is, if somehow I can grep for only two consecutive hyphens
--, I want to find the pattern as though it was a perfect match like
-w would do. So something like
i--; would not feature as a result. But
i -- would. Maybe there's a simple solution but I can't seem to figure it out.