I am trying to understand the difference between grep -e and grep -E. Now from grep manpage I got:
-E, --extended-regexp
Interpret PATTERN as an extended regular expression (see below).
-e PATTERN, --regexp=PATTERN
Use PATTERN as the pattern; useful to protect patterns beginning with -
The above explanation does not make sense for me.
So, can someone explain it to me using examples what is the difference between the two and when to use which option.
PS: Version: grep (GNU grep) 2.10
-eis really just to disambiguate when a regex starts with a dash. Sogrep ---foogivesunrecognized option: ---foobut you can saygrep -e ---footo grep for the regular expression---foo. – tripleee Oct 10 '12 at 19:31