page

Jan 29, 2020

grep : Using grep to search for a string that has a dot in it

https://stackoverflow.com/questions/10346816/using-grep-to-search-for-a-string-that-has-a-dot-in-it

 in grep,  . means "any character" in a regex.

-F  : which would interpret the pattern as a fixed string
-w :  Checking for full words, not for sub-strings using grep -w


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 \\.

No comments:

Post a Comment