How to use grep to match multiple strings in the same line?
grep 'string1|string2' filename
grep -E "string1|string2" filename
How can I grep for a string that begins with a dash/hyphen?
1. Quote AND/OR escape
Code:
ls | grep "-a"
(that is the escape character)
or
2. Use flag "--" to stop switch parsing
Code:
ls | grep -- -a