grep 在 GNOME 桌面 (Linux) 中傳回錯誤訊息

grep 在 GNOME 桌面 (Linux) 中傳回錯誤訊息

我需要在資料夾結構中搜尋特定字串。

文件系統包含多個文件,但我只需要檢查 XML 文件。

我搜尋並嘗試了 Linux 遞歸搜尋的命令,但它不起作用。我從命令中得到以下輸出

$ grep -rio --include=*.xml "invokeAction" .
grep: No match.
$ grep -riwc "invokeAction" *
grep: <.Lists all the file Names recursively.>: No such file or directory
$ grep -ir invokeAction *.xml
grep: <.Lists all the file Names.>: No such file or directory

請幫忙。

我需要搜尋

String: "invokeAction"
Mode: Word Only
Directory: Current Directory Recursively 

答案1

這將從路徑中遞歸搜尋所有 python 檔案 (*.py) 並在每個檔案上執行 grep -l import

find /path/To/Seach -iname \*.py -exec grep -l import {} \;

相關內容