Is there a way to grep
(or use another command) to find exact strings, using NO regex?
For example, if I want to search for (literally):
/some/file"that/has'lots\of"invalid"chars/and.triggers$(#2)[*~.old][3].html
I don't want to go through and escape every single "escapable". Essentially, I want to pass it through, like I would with echo
:
$ echo "/some/file\"that/has'lots\of\"invalid\"chars/and.triggers$(#2)[*~.old][3].html"
/some/file"that/has'lots\of"invalid"chars/and.triggers$(#2)[*~.old][3].html
Use
fgrep
, it's the same asgrep -F
(matches a fixed string).Well, you can put the information you want to match, each in a line, and then use
grep
:Notice the usage of the flag
-F
, which causesgrep
to consider each line of the file patterns.txt as afixed-string
to be searched in file.txt.