그놈 데스크탑(Linux)에서 grep이 잘못된 메시지를 반환합니다.

그놈 데스크탑(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 {} \;

관련 정보