%EC%97%90%EC%84%9C%20grep%EC%9D%B4%20%EC%9E%98%EB%AA%BB%EB%90%9C%20%EB%A9%94%EC%8B%9C%EC%A7%80%EB%A5%BC%20%EB%B0%98%ED%99%98%ED%95%A9%EB%8B%88%EB%8B%A4..png)
폴더 구조 내부의 특정 문자열을 검색해야 합니다.
파일 시스템에는 여러 파일이 포함되어 있지만 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 {} \;