문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
linux:grep [2016/08/08 15:54] kwon37xi [특정 파일명에서 문자열 찾기] |
linux:grep [2021/08/24 13:54] kwon37xi |
||
---|---|---|---|
줄 2: | 줄 2: | ||
===== 특정 파일명에서 문자열 찾기 ===== | ===== 특정 파일명에서 문자열 찾기 ===== | ||
- | | + | <code sh> |
+ | # 현재 디렉토리 파일 한정 | ||
+ | grep < | ||
+ | </ | ||
+ | |||
+ | | ||
+ | <code sh> | ||
+ | # 하위 디렉토리를 포함하려면 -R --include=GLOB 을 사용 | ||
# grep -R --include=GLOB " | # grep -R --include=GLOB " | ||
grep -R --include=" | grep -R --include=" | ||
줄 23: | 줄 30: | ||
* '' | * '' | ||
* '' | * '' | ||
+ | |||
+ | ===== 여러 단어 검색 ===== | ||
+ | * [[https:// | ||
+ | <code sh> | ||
+ | grep ' | ||
+ | ### Search all text files ### | ||
+ | grep ' | ||
+ | ### Search all python files for ' | ||
+ | grep ' | ||
+ | grep -E ' | ||
+ | grep -e string1 -e string2 *.pl | ||
+ | egrep " | ||
+ | </ | ||
===== 기타 옵션 ===== | ===== 기타 옵션 ===== | ||
줄 29: | 줄 49: | ||
===== grep 대체 ===== | ===== grep 대체 ===== | ||
* [[linux: | * [[linux: | ||
+ | * [[linux: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
* [[http:// | * [[http:// |