开发者

Using grep with a complex string

开发者 https://www.devze.com 2022-12-19 23:00 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消