2012-01-12 20 views
1

我試圖運行此正則表達式的grep中 - 慶典拿起串

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 

但是,當我打回車鍵,然後進入這個:

> 

指示我有公開報價。任何人都可以協助嗎?

感謝

+1

你有一個流浪'「'在你的第二個例子 – 2012-01-12 04:12:06

回答

1

如何引用這整個事情,逃避內部報價:

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

這不起作用,只是坐在那兒,語法錯了 – Jason 2012-01-12 04:14:47

+0

哎呀,分號弄丟了,修正了, – blahdiblah 2012-01-12 04:23:44

+0

謝謝你,乾杯 – Jason 2012-01-13 02:14:33

1

這個怎麼樣 -

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

我覺得你的報價已經出錯了 – Jason 2012-01-13 02:14:56

+0

對不起。哪一個? – 2012-01-13 02:24:47