Michal Ligus <[email protected]> writes:
> To reproduce:
>
> cat {your_file} | grep '^\+'

The message in question is:

    $ grep '^\+' </dev/null
    grep: warning: stray \ before +

The message is correct, in the "basic regular expression" mode, "\+" is
not a legitimate regular expression.

However if you enable "extended regular expression mode", "\+" *is* a
legitimate regular expression, it matches the character "+".  (In this
mode, "+" alone is a regexp operator.)  And grep doesn't give you a
warning:

    $ grep -E '^\+' </dev/null

My recommendation is that you either give grep the -E option, so that
"^\+" correctly denotes what you want to search for, or that you give it
the argument "^+", which correctly denotes what you want to search for
in basic mode.

Dale



Reply via email to