Why can’t grep find negative numbers?

Suppose you’re looking for instances of -42 in a file foo.

txt.

The command grep -42 foo.

txt won’t work.

Instead you’ll get a warning message like the following.

Usage: grep [OPTION].

PATTERN [FILE].

Try grep –help for more information.

Putting single or double quotes around -42 won’t help.

The problem is that grep interprets 42 as a command line option, and.. More details

Leave a Reply