windows 에서 grep 과 비슷한 역활의 명령

imcjswo의 이미지

windows 에서 grep 과 비슷한 역활을 하는 명령어가 있나요?
C드라이브 전체를 대상으로 'aaa'라는 문자열을 파일마다 검색하고 싶을때
어떻게 해야 할까요?

nthroot의 이미지

'검색'에서 '파일에 들어있는 단어 또는 문장'

------식은이 처------
길이 끝나는 저기엔 아무 것도 없어요. 희망이고 나발이고 아무 것도 없어.

랜덤여신의 이미지

그냥 grep 설치해서 쓰심이 어떨지요? ;)

http://gnuwin32.sourceforge.net/

ngtao의 이미지

grep를 설치할 수 없는 사정이 있다면,
"FINDSTR"을 사용하세요...

C:\>findstr /?
Searches for strings in files.

FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
        [/C:string] [/G:file] [/D:dir list] [/A:color attributes]
        [strings] [[drive:][path]filename[ ...]]

  /B        Matches pattern if at the beginning of a line.
  /E        Matches pattern if at the end of a line.
  /L        Uses search strings literally.
  /R        Uses search strings as regular expressions.
  /S        Searches for matching files in the current directory and all
            subdirectories.
  /I        Specifies that the search is not to be case-sensitive.
  /X        Prints lines that match exactly.
  /V        Prints only lines that do not contain a match.
  /N        Prints the line number before each line that matches.
  /M        Prints only the filename if a file contains a match.
  /O        Prints character offset before each matching line.
  /P        Skip files with non-printable characters
  /A:attr   Specifies color attribute with two hex digits. See "color /?"
  /F:file   Reads file list from the specified file(/ stands for console).
  /C:string Uses specified string as a literal search string.
  /G:file   Gets search strings from the specified file(/ stands for console).
  /D:dir    Search a semicolon delimited list of directories
  strings   Text to be searched for.
  [drive:][path]filename
            Specifies a file or files to search.

Use spaces to separate multiple search strings unless the argument is prefixed
with /C.  For example, 'FINDSTR "hello there" x.y' searches for "hello" or
"there" in file x.y.  'FINDSTR /C:"hello there" x.y' searches for
"hello there" in file x.y.

Regular expression quick reference:
  .        Wildcard: any character
  *        Repeat: zero or more occurances of previous character or class
  ^        Line position: beginning of line
  $        Line position: end of line
  [class]  Character class: any one character in set
  [^class] Inverse class: any one character not in set
  [x-y]    Range: any characters within the specified range
  \x       Escape: literal use of metacharacter x
  \<xyz    Word position: beginning of word
  xyz\>    Word position: end of word

For full information on FINDSTR regular expressions refer to the online Command
Reference.
ironpapa의 이미지

Find 명령이 있습니다.

----- 아래는 find의 도움말입니다.

FIND [/V] [/C] [/N] [/I] "문자열" [[드라이브:][경로]파일이름[ ...]]

/V 지정한 문자열이 없는 줄을 표시합니다.
/C 지정한 문자열이 있는 줄 수만을 표시합니다.
/N 지정한 문자열이 있는 각 줄 앞에 줄 번호를 붙입니다.
/I 대/소문자를 구별하지 않고 찾습니다.
"문자열" 찾을 문자열을 지정합니다.
[드라이브:][경로]파일이름
찾을 파일의 위치와 이름을 지정합니다.

경로가 지정되지 않으면, FIND는 프롬프트에서 입력되거나 다른 명령에서 파이프(|)된 텍스트에서 찾습니다.

철이 아빠 입니다. :D

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.