Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- plugin
- IntelliJ
- Eclipse
- context
- Source
- profile
- VirtualBox
- JavaScript
- bash
- import
- tomcat
- 줄바꿈 문자
- port
- resource
- web.xml
- ssh
- find
- Windows 10
- 네트워크
- vscode
- lsof
- xargs
- netsh
- Mac
- grep
- GIT
- Quartz
- maVen
- 단축키
- Windows
Archives
- Today
- Total
develog
[bash] find egrep xargs grep, 파일 리스트 / 파일 내용 검색 본문
파일 리스트 검색
- find 로 파일을 검색하고
- 정규식으로 필터링한다 (egrep, grep -E)
파일명에 class 또는 xml 이 포함된 파일을 찾는다
## egrep -i : 대소문자 무시
find . -type f | egrep -i 'class|xml'
확장자가 .jsp 로 끝나지 않는 jsp 파일을 검색한다
find . -type f | grep '.jsp' | grep -v -E '\.jsp$'
파일 내용 검색
파일명 필터링 (대소문자 무시)
파일 내용 검색 (대소문자 무시) 후 파일명과 내용 출력
find . -type f | egrep -i '(XML|PROPERTIES)$' | xargs egrep -i 'DEFAULT'
파일명 필터링 (.xml, .jsp)
내용에 'Logger'(대소문자 무시) 가 있는 파일의 파일명과 내용 출력
find . -type f | egrep '.xml|.jsp' | xargs grep -i 'Logger'
파일명 필터링 (.xml, .jsp)
내용에 'Logger' 가 있는 파일의 파일명만 출력
find . -type f | egrep '.xml|.jsp' | xargs grep -l 'Logger'
'OS & Shell > bash' 카테고리의 다른 글
[bash] array loop (0) | 2021.04.14 |
---|---|
[bash] source, include other bash file (0) | 2021.04.01 |
[bash] split path & filename (0) | 2021.03.09 |
[bash] del-log.sh (0) | 2021.03.02 |
[bash] 변수값을 '_' (underscore) 로 연결하기 (0) | 2021.03.02 |
Comments