Hi,
I want to search for a return code of -3. Using grep "-3" *.* is giving a syntax error. Please suggest as to how can we search for this pattern using grep.
Thanks,
Krishna
Hi,
I want to search for a return code of -3. Using grep "-3" *.* is giving a syntax error. Please suggest as to how can we search for this pattern using grep.
Thanks,
Krishna
grep thinks the '-' starts an option and tries to interpret it. Try escaping it, eg. grep '\-3' *.*
Try -- to sign end of options. This is a general rule for such problems, e.g.
To grep -3 try:
grep -- -3 ...
If yoy want to remove a file named -panos you give:
rm -- -panos
etc.
This fact is true due to getopt function. This function is used by system programers
who write tools like grep, rm etc. The function marks end of option with a double dash
(--), so the behavior is similar for all tools using getopt to process options.