Using grep to search for a string that has a dot in it
grep -F -r '0.49' *
treats 0.49 as a "fixed" string instead of a regular expression. This makes .
lose its special meaning.
grep
uses regexes; .
means "any character" in a regex. If you want a literal string, use grep -F
, fgrep
, or escape the .
to \.
.
Don't forget to wrap your string in double quotes. Or else you should use \\.
So, your command would need to be:
grep -r "0\.49" *
or
grep -r 0\\.49 *
or
grep -Fr 0.49 *
You need to escape the .
as "0\.49"
.
A .
is a regex meta-character to match any character(except newline). To match a literal period, you need to escape it.