Using grep with a complex string
I am looking in the content of several files for strings like:
(2E)-3-({5,6-dihydroxy-3-methyl-2-oxo-4-[(1E)-prop-1-en-1-yl]-2,3-dihydro-1-benzofuran
with grep, so I try to do:开发者_JAVA技巧
grep -n "(2E)-3-({5,6-dihydroxy-3-methyl-2-oxo-4-[(1E)-prop-1-en-1-yl]-2,3-dihydro-1-benzofuran" *.data
but I get errors, probably due to the fact that the string is complex.
Are there additional grep options or another way for me to find this string in the files?
Thanks
I don't have my man pages to hand, but have you tried grep -F
? I think it turns off regexp and treats the pattern as a fixed string. fgrep
does the same.
精彩评论