grep 中的正则表达式 - 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=merchant --exclude-dir=newport '"\(\w*\)\.execute\("ATTACH DATABASE \'/include/location\.db\' AS \(\w*\)"\);' *.esp
但是当我按 Enter 时,它会转到此:
>
指示我有一个开放报价。有人可以帮忙吗?
谢谢
I'm trying to run this
grep -R -l --exclude-dir=merchant --exclude-dir=newport (\w*)\.execute\("ATTACH DATABASE '/include/location\.db' AS (\w*)"\); * | wc -l
but I keep getting this error
-sh: syntax error near unexpected token `('
I've tried escaping all the brackets like this:
grep -R -l --exclude-dir=merchant --exclude-dir=newport '"\(\w*\)\.execute\("ATTACH DATABASE \'/include/location\.db\' AS \(\w*\)"\);' *.esp
But when I hit enter, it then goes to this:
>
Indicating that I have an open quote. Can anyone assist here?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个怎么样——
How about this one -
引用整个内容并转义内部引号怎么样:
How about quoting that whole thing and escaping the internal quotes: