如何使用grep匹配双引号

How to match double quotes using grep

我以为我知道这个(或者至少知道如何 google)!

但是在文本文件中搜索模式时,我不知道如何使用 grep 匹配双引号。我试图用反斜杠转义双引号,但似乎不起作用。

>cat trial.txt  
"Bill" is here and "Ben" is there

> grep -iE "and \"ben\" is" trial.txt
Unmatched ".

如何让它工作?

使用单引号来考虑每个字符的字面意思。

grep 'and "Ben" is' trial.txt