GNOME デスクトップ (Linux) で grep が間違ったメッセージを返す

GNOME デスクトップ (Linux) で grep が間違ったメッセージを返す

フォルダー構造内の特定の文字列を検索する必要があります。

ファイル システムには複数のファイルが含まれていますが、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 {} \;

関連情報