Using grep with a complex string

I am browsing the contents of several files for strings:

(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:

 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 am getting errors, probably due to the fact that the string is complex.

Are there any additional grep options or another way to find this line in files?

thanks

+3
source share
1 answer

I have no pages of my hands, but have you tried grep -F ? I think it disables the regex and treats the pattern as a fixed string. fgrep does the same.

+5
source

Source: https://habr.com/ru/post/892300/


All Articles