On Sun, Nov 28, 2004 at 04:34:55PM +0100, Frederick Ros wrote:
> Tux wrote :
> | Hi,
> | I just remembered "grep" use "--basic-regexp" as default.
> | Should we add "-F" and/or "-e" as soon as the following expression is not
> | using regexp or only when necessary?
> |
> | === 2 solutions: ===
> |
> | - add -F or -e only when necessary
> | ...
> |
> | - always add -F -e
> |
> |
> | I think that the second solution is better to avoid mistakes.
>
> Humm .. Yes but was is the behaviour when using these 2 options
> *together* .. Didn't they clash ?
-e means the following argument is the search string. Useful for
strings beginning with "-".
-F means the search string is no regex, but a newline separated list of
words to look for literally.
-E, --extended-regexp (egrep)
-F, --fixed-strings (fgrep)
-G, --basic-regexp (grep)
-P, --perl-regexp
The "how" options seem to be always upper case letters...
A 100% literal match is not possible without escaping strings to
regexps. Without escaping "-F" is quite close...
To reduce the "default" grep option list, you can also - 3. solution -
escape every string to a basic regex.
Bye,
Robert