How to get the lines that contain -R with grep

grep

How can I find "-R" in files with grep?
I tried grep "-R" *.GNU to get the lines that contain -R, but it returns nothing.

Best Answer

Try:

grep -- -R *.GNU

The -- indicates end of options so that -R is seen as an argument instead of an option to grep

Related Question