使用grep用复杂的字符串 [英] Using grep with a complex string

查看:149
本文介绍了使用grep用复杂的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待在几个文件的内容对于像字符串:

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

使用grep,所以我尽量做到:

with grep, so I try to do:

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.

是否有额外的grep选项或另一种方式给我找这个字符串中的文件?

Are there additional grep options or another way for me to find this string in the files?

感谢

推荐答案

我没有我的男人页面的手,但你尝试过的grep -F ?我认为它会关闭正则表达式,并将这些图案作为固定字符串。 fgrep一样不一样的。

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.

这篇关于使用grep用复杂的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆