我想要實作的是,我想在我當前的根目錄下找到所有包含檔案中單詞的.txt檔案。更詳細地說,我想找到所有使用 bootstrap3 類名(任何檔案擴展名)的檔案。
所以,基本上,我將有一個.txt包含所有 bootstrap3 類名(例如col-md-1,container-fluid等)的串列
我曾經grep -lir <word>搜索過包含文本的檔案,但我想做的是回傳包含特定單詞集中任何單詞的檔案。
這將如何作業?
uj5u.com熱心網友回復:
來自man grep:
-f FILE, --file=FILE
Obtain patterns from FILE, one per line. If this option is
used multiple times or is combined with the -e (--regexp)
option, search for all patterns given. The empty file
contains zero patterns, and therefore matches nothing.
就像是grep -irl -f words.txt dir-to-search
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/457900.html
上一篇:**在搜索路徑時如何作業
