본문 바로가기

CMD에서 파일 찾기

액트 2022. 11. 29.
반응형

[Find 명령어]

find "(찾을 문자)" (경로) *  ( find "hello" c:\file* )

= c:\file 디렉토리의 모든 파일에서 "hello"가 포함된 라인을 출력

 

find /N "hello" c:\file*

= 파일에서 탐지된 "hello" 문자가 몇번째 라인인지 알고싶을 때

 

 find /N /I "hello" c:\file*

= 대소문자 구분 없이 찾고 싶을 때

 

[Findstr 명령어]

findstr "(찾을 문자)" (경로) *  ( findstr "hello" c:\file* )

= c:\file디렉토리의 모든 파일에서 "hello"가 포함된 라인을 출력

 

findstr /N "hello" c:\file*

= 파일에서 탐지된 "hello" 문자가 몇번째 라인인지 알고싶을 때

 

findstr /N /S "hello" c:\file*

= 하위 폴더까지 검색할 때

 

findstr /N /S "hello" *.txt

= 특정 확장자 파일만 검색할 때

 

 

[응용]

= dir c:\note | find /N /I "hello"

= ipconfig | findstr "게이트웨이"

반응형

댓글