grep中的正则表达式-bash拾取字符串

grep中的正则表达式-bash拾取字符串,bash,Bash,我正在试着运行这个 grep -R -l --exclude-dir=merchant --exclude-dir=newport (\w*)\.execute\("ATTACH DATABASE '/include/location\.db' AS (\w*)"\); * | wc -l 但我总是犯这个错误 -sh: syntax error near unexpected token `(' 我试着像这样避开所有的括号: grep -R -l --exclude-dir=merchan

我正在试着运行这个

grep -R -l --exclude-dir=merchant --exclude-dir=newport (\w*)\.execute\("ATTACH DATABASE '/include/location\.db' AS (\w*)"\);  * | wc -l
但我总是犯这个错误

-sh: syntax error near unexpected token `('
我试着像这样避开所有的括号:

grep -R -l --exclude-dir=merchant --exclude-dir=newport '"\(\w*\)\.execute\("ATTACH DATABASE \'/include/location\.db\' AS \(\w*\)"\);'  *.esp
但当我按enter键时,它会转到以下位置:

>
表明我有一个开放的报价。有人能帮忙吗


谢谢

如何引用整件事并避开内部引用:

grep -R -l --exclude-dir=merchant --exclude-dir=newport "(\w*)\.execute\(\"ATTACH DATABASE '/include/location\.db' AS (\w*)\"\);"  * | wc -l
这个怎么样-

grep -R -l --exclude-dir=merchant --exclude-dir=newport '(\w*)\.execute\("ATTACH DATABASE '/include/location\.db' AS (\w*)"\);'  * | wc -l

在第二个示例中,出现了一个错误的
。哎呀,分号松动了。已修复。我认为您的引号出现了错误