사용자 도구

사이트 도구


linux:grep

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
linux:grep [2020/07/03 16:03]
kwon37xi [grep 대체]
linux:grep [2021/08/24 13:54]
kwon37xi [특정 파일명에서 문자열 찾기]
줄 2: 줄 2:
  
 ===== 특정 파일명에서 문자열 찾기 ===== ===== 특정 파일명에서 문자열 찾기 =====
-  * [[http://www.cyberciti.biz/faq/unix-linux-grep-include-file-pattern-recursive-example/|grep include file pattern recursive example]]<code sh>+<code sh> 
 +# 현재 디렉토리 파일 한정 
 +grep <pattern> <file> 
 +</code> 
 + 
 +  * [[http://www.cyberciti.biz/faq/unix-linux-grep-include-file-pattern-recursive-example/|grep include file pattern recursive example]] 
 +<code sh> 
 +# 하위 디렉토리를 포함하려면 -R --include=GLOB 을 사용
 # grep -R --include=GLOB "pattern" /path/to/dir # grep -R --include=GLOB "pattern" /path/to/dir
 grep -R --include="*.txt" "pattern" /path/to/dir grep -R --include="*.txt" "pattern" /path/to/dir
 grep -R --include="*.txt" "foo" ~/projects/ grep -R --include="*.txt" "foo" ~/projects/
 </code> </code>
-  * ''xargs'' 사용<code sh>+  * ''xargs'' 사용 
 +<code sh>
 find . -name "*.java" | xargs grep "Some code to find" find . -name "*.java" | xargs grep "Some code to find"
 </code> </code>
-  * ''findtext'' <code sh>+  * ''findtext''  
 +<code sh>
 #!/bin/sh #!/bin/sh
 # findtext "검색어" "파일명" # findtext "검색어" "파일명"
linux/grep.txt · 마지막으로 수정됨: 2023/05/15 17:03 저자 kwon37xi