fgrep

GREP(1)                     General Commands Manual                    GREP(1)



å称
       grep, egrep, fgrep, zgrep, zegrep, zfgrep, bzgrep, bzegrep, bzfgrep -
       ãã¿ã¼ã³ã«ãããããè¡ã表示ãã

æ¸å¼
       grep [options] PATTERN [FILE...]
       grep [options] [-e PATTERN | -f FILE] [FILE...]

解説
       grep ã¯ã FILE ã§ååãæå®ãããå¥åãã¡ã¤ã« (ãã¡ã¤ã«ãæå®ããã¦ãªããã FILE ã®é¨åã«
       - ãæå®ãããå ´åã¯æ¨æºå¥å) ãèªã¿è¾¼ã¿ãä¸ãããã PATTERN
       ã«ãããããé¨åãå«ãè¡ãæ¢ãã¾ãã ããã©ã«ãåä½ã§ã¯ã grep ã¯ãããããè¡ã表示ãã¾ãã

       ããã«ã2 ã¤ã®ããã°ã©ã  egrep 㨠fgrep ãå©ç¨å¯è½ã§ãã egrep 㯠grep -E
       ã¨åãã§ãã fgrep 㯠grep -F ã¨åãã§ãã zgrep 㯠grep -Z ã¨åãã§ãã zegrep ã¯
       grep -EZ ã¨åãã§ãã zfgrep 㯠grep -FZ ã¨åãã§ãã

ãªãã·ã§ã³
       -A NUM, --after-context=NUM
              NUM ã§æå®ããè¡æ°ã ãããã¿ã¼ã³ã«ãããããè¡ã®å¾ã®è¡ã表示ãã¾ãã
              ãããããã°ã«ã¼ãã®éã«ã¯ã -- ãå«ãè¡ãæ¿å¥ãã¾ãã

       -a, --text
              ãã¤ããªãã¡ã¤ã«ãããã¹ããã¡ã¤ã«ã§ãããã®ããã«å¦çãã¾ãã ãã㯠--binary-
              files=text ãªãã·ã§ã³ã¨ç価ã§ãã

       -B NUM, --before-context=NUM
              NUM ã§æå®ããè¡æ°ã ãããã¿ã¼ã³ã«ãããããè¡ã®åã®è¡ã表示ãã¾ãã
              ãããããã°ã«ã¼ãã®éã«ã¯ã -- ãå«ãè¡ãæ¿å¥ãã¾ãã

       -C NUM, --context=NUM
              NUM ã§æå®ããè¡æ°ã ãããã¿ã¼ã³ã«ãããããè¡ã®åå¾ã®è¡ã表示ãã¾ãã
              ãããããã°ã«ã¼ãã®éã«ã¯ã -- ãå«ãè¡ãæ¿å¥ãã¾ãã

       -b, --byte-offset
              ååºåè¡ã®åã«ãå¥åãã¡ã¤ã«ã®åé ããã®ãã¤ãåä½ã®ãªãã»ããã表示ãã¾ãã

       --binary-files=TYPE
              ãã¡ã¤ã«ã®æåã®æ°ãã¤ããã
              ãã¡ã¤ã«ã®å容ããã¤ããªãã¡ã¤ã«ã§ãããã¨ã示ãå ´åã ãã¡ã¤ã«ã®ã¿ã¤ãã
              TYPE ã§ããã¨ä»®å®ãã¾ãã ããã©ã«ãã§ã¯ TYPE 㯠binary ã§ããã grep
              ã¯é常ããã¤ããªãã¡ã¤ã«ã®ä¸è´ã示ãä¸è¡ã¡ãã»ã¼ã¸ã表示ãããã
              ãããããªãå ´åã«ã¯ãªã«ã表示ãã¾ããã TYPE ã without-match ã®å ´åã
              grep ã¯ãã¤ããªãã¡ã¤ã«ã¯ãããããªããã®ã¨ä»®å®ãã¾ãã ãã㯠-I
              ãªãã·ã§ã³ã¨ç価ã§ãã TYPE ã text ã®å ´åã grep ã¯ãã¤ããªãã¡ã¤ã«ããã‐
              ã¹ãã§ãããã®ããã«æ±ãã¾ãã ãã㯠-a ãªãã·ã§ã³ã¨ç価ã§ãã è¦å: grep
              --binary-files=text ã¯ãã¤ããªã®ã´ãã表示ããå¯è½æ§ãããã¾ãã
              åºååã端æ«ã§ããå ´åã§ã
              端æ«ãã©ã¤ãããã®ã´ãã®ä¸é¨ãã³ãã³ãã§ããã¨è§£éããå ´åã
              ãã®ã´ããæªãå¯ä½ç¨ãããã¼ãå¯è½æ§ãããã¾ãã

       --colour[=WHEN], --color[=WHEN]
              ãããããæååã GREP_COLOR ç°å¢å¤æ°ã§ã§æå®ããããã¼ã«ã§å²ã¿ã¾ãã WHEN
              ã¯ã`never' ã¾ã㯠`always'ã`auto' ã®ã©ããã§ãã

       -c, --count
              é常ã®åºåã¯ãããåå¥åãã¡ã¤ã«ã«ã¤ãã¦ãããããè¡æ°ã表示ãã¾ãã -v,
              --invert-match ãªãã·ã§ã³ã¨å±ã«æå®ããå ´åã¯ã
              ãããããªãã£ãè¡æ°ã表示ãã¾ã (ä¸è¨åç§)ã

       -D ACTION, --devices=ACTION
              å¥åãã¡ã¤ã«ãããã¤ã¹ãFIFO ãããã¯ã½ã±ããã®å ´åã ACTION
              ã使ã£ã¦ãã®å¦çãè¡ãã¾ã ããã©ã«ãã§ã¯ ACTION 㯠read
              ã§ãããããã¤ã¹ãé常ãã¡ã¤ã«ã§ãããã®ããã«èªã¿åãäºãæå³ãã¾ãã ACTION ã
              skip ãªããããã¤ã¹ãé»ã£ã¦èªã¿é£ã°ãã¾ãã

       -d ACTION, --directories=ACTION
              å¥åãã¡ã¤ã«ããã£ã¬ã¯ããªã®å ´åã«ã ACTION
              ã使ã£ã¦ãã®å¦çãè¡ãã¾ããããã©ã«ãã§ã¯ ACTION 㯠read
              ã§ããããã£ã¬ã¯ããªãæ®éã®ãã¡ã¤ã«ã§ãããã®æ§ã«èªã¿åãäºãæå³ãã¾ãã ACTION
              ã skip ãªãããã£ã¬ã¯ããªãé»ã£ã¦èªã¿é£ã°ãã¾ãã ACTION ã recurse ãªãã
              grep ã¯åãã£ã¬ã¯ããªä¸ã®ãã¹ã¦ã®ãã¡ã¤ã«ãå帰çã«èªã¿åãã¾ãã ãã㯠-r
              ãªãã·ã§ã³ã¨ç価ã§ãã

       -E, --extended-regexp
              PATTERN ãæ¡å¼µãããæ£è¦è¡¨ç¾ã¨ãã¦æ±ãã¾ã (ä¸è¨åç§)ã

       -e PATTERN, --regexp=PATTERN
              PATTERN ããã¿ã¼ã³ã¨ãã¦æå®ãã¾ãã - ã§å§ã¾ããã¿ã¼ã³ãä¿è·ããããã«æå¹ã§ãã

       -F, --fixed-strings
              PATTERN ãæ¹è¡ã§åºåãããåºå®æååã®ãªã¹ãã¨ãã¦æ±ãã¾ãã ãã®æå‐
              åã®ã©ããã¨ããããããã調ã¹ã¾ãã

       -P, --perl-regexp
              PATTERN ã Perl ã®æ£è¦è¡¨ç¾ã¨ãã¦è§£éãã¾ãã

       -f FILE, --file=FILE
              ãã¿ã¼ã³ã FILE ãã 1 è¡ãã¨ã«èªã¿è¾¼ã¿ã¾ãã
              空ã®ãã¡ã¤ã«ã¯ãã¿ã¼ã³ãå«ã¾ãªãã®ã§ãä½ã«ãããããã¾ããã

       -G, --basic-regexp
              PATTERN ãåºæ¬çãªæ£è¦è¡¨ç¾ã¨ãã¦æ±ãã¾ã (ä¸è¨åç§)ãããã©ã«ãã§ãã

       -H, --with-filename
              åãã®ãããã«å¯¾ãã¦ãã¡ã¤ã«åã表示ãã¾ãã

       -h, --no-filename
              è¤æ°ãã¡ã¤ã«ãæ¤ç´¢ããæã«ãåºåã®åã«ãã¡ã¤ã«åãä»ãããã¨ãæå¶ãã¾ãã

       --help ç°¡åãªãã«ãã¡ãã»ã¼ã¸ãåºåãã¾ãã

       -I     ãã¤ããªãã¡ã¤ã«ãããããããã¼ã¿ãå«ã¾ãªããã®ããã«å¦çãã¾ãããã㯠--binary-
              files=without-match ãªãã·ã§ã³ã¨ç価ã§ãã

       -i, --ignore-case
              PATTERN ã¨å¥åãã¡ã¤ã«ã®åæ¹ã§ãè±å¤§æåã¨å°æåã®åºå¥ãããªãããã«ãã¾ãã

       -L, --files-without-match
              é常ã®åºåã¯ããã ãã®ãªãã·ã§ã³ãæå®ããªãã£ãã¨ãã«
              å¨ãåºåãããªãå¥åãã¡ã¤ã«ã®ååã表示ãã¾ãã ã¹ã‐
              ã£ã³åä½ã¯æåã®ãããã§çµäºãã¾ãã

       -l, --files-with-matches
              é常ã®åºåã¯ããã ãã®ãªãã·ã§ã³ãæå®ããªãã£ãã¨ãã«
              åºåãããå¥åãã¡ã¤ã«ã®ååã表示ãã¾ãã ã¹ãã£ã³åä½ã¯æåã®ãããã§çµäºãã¾ãã

       -m NUM, --max-count=NUM
              NUM åã®ãããããè¡ã®ãã¨ããã¡ã¤ã«ã®èªã¿åããåæ¢ãã¾ãã
              ãããé常ãã¡ã¤ã«ããæ¨æºå¥åãä»ãã¦å¥åãè¡ããã¦ããã NUM
              åã®ãããããè¡ãåºåã ã£ãå ´åã ãã®å¾ã«ç¶ãã³ã³ããã¹ãè¡ããããã©ããã«é¢ãããã
              grep
              ã¯ãçµäºããåã«æ¨æºå¥åãæå¾ã«ãããããè¡ã®ç´å¾ã«ä½ç½®ãããäºãä¿è¨¼ãã¾ãã
              ããã«ãã£ã¦ãå¼ã³åºããããã»ã¹ãæ¤ç´¢ãåéããäºãå¯è½ã¨ãªãã¾ãã NUM
              åã®ãããããè¡ã®å¾ã«åæ¢ããå ´åã grep ã¯ããã®å¾ã«ç¶ãã³ã³ãã‐
              ã¹ãè¡ãåºåãã¾ãã -c ã --count ãªãã·ã§ã³ãæå®ãããå ´åã grep 㯠NUM
              ãã大ããªè¡æ°ãåºåãã¾ããã -v ã --invert-match ãªãã·ã§ã³ãæå®ãããå ´åã
              grep 㯠NUM åã®ãããããªãè¡ã®åºåå¾ã«åæ¢ãã¾ãã

       --mmap å¯è½ãªãã°ãããã©ã«ãã® read(2) ã·ã¹ãã ã³ã¼ã«ã®ä»£ããã« mmap(2)
              ã·ã¹ãã ã³ã¼ã«ã使ã£ã¦å¥åãèªã¿åãã¾ãã ããç¶æ³ã«ããã¦ã --mmap
              ã¯ããããæ§è½ãããããã¾ãã ãããã grep ã®åä½ä¸ã«å¥åãã¡ã¤ã«ãå°ãããªãããã¾ãã¯
              I/O ã¨ã©ã¼ãçããå ´åã«ã --mmap 㯠(ã³ã¢ãã³ããå«ã)
              æªå®ç¾©ã®åä½ãå¼ãèµ·ããå¯è½æ§ãããã¾ãã

       -n, --line-number
              ååºåè¡ã®åã«ãå¥åãã¡ã¤ã«ã«ãããè¡çªå·ã表示ãã¾ãã

       -o, --only-matching
              ãããããè¡ã® PATTERN ã«ãããããé¨åã®ã¿ã表示ãã¾ãã

       --label=LABEL
              å®éã«ã¯æ¨æºå¥åããã®å¥åãããã¡ã¤ã« LABEL ããã®å¥åã¨ãã¦è¡¨ç¤ºãã¾ãã
              ãã㯠zgrep ãªã©ã®ãã¼ã«ã«å¯¾ãã¦ãç¹ã«ä¾¿å©ã§ãã ä¾: gzip -cd foo.gz
              |grep --label=foo something

       --line-buffered
              è¡ãã¨ã«åºåããããªãã¾ãã ããã¯ããã©ã¼ãã³ã¹ãæªããªãäºãããã¾ãã

       -q, --quiet, --silent
              æ²é»: æ¨æºåºåã«ã¯ä½ãåºåãã¾ããã
              ä½ããããããå ´åãã¨ã©ã¼ãèµ·ããæã§ãç´ã¡ã«è¿ãå¤ 0 ã§çµäºãã¾ãã -s ã
              --no-messages ãªãã·ã§ã³ãåç§ã

       -R, -r, --recursive
              åãã£ã¬ã¯ããªä¸ã®ãã¹ã¦ã®ãã¡ã¤ã«ãå帰çã«èªã¿åãã¾ãã ãã㯠-d recurse
              ãªãã·ã§ã³ã¨ç価ã§ãã

         --include=PATTERN
              PATTERN ã«ããããããã¡ã¤ã«ã®ã¿ãæ¤ç´¢ããªããããã£ã¬ã¯ããªãå帰ãã¾ãã

         --exclude=PATTERN
              PATTERN ã«ããããããã¡ã¤ã«ãèªã¿é£ã°ããªããããã£ã¬ã¯ããªãå帰ãã¾ãã

       -s, --no-messages
              æå®ããããã¡ã¤ã«ãåå¨ããªããã¨ãèªã¿è¾¼ã¿ã§ããªããã¨ã示ã
              ã¨ã©ã¼ã¡ãã»ã¼ã¸ãææ¢ãã¾ãã 移æ¤æ§ã«é¢ãã注: GNU grep ã¨ã¯ç°ãªãã
              ä¼çµ±ç㪠grep 㯠POSIX.2 ã«é©åãã¦ãã¾ããã§ããããªããªããä¼çµ±ç㪠grep
              ã«ã¯ -q ãªãã·ã§ã³ãç¡ãã -s ãªãã·ã§ã³ã¯ GNU grep ã® -q
              ãªãã·ã§ã³ã®æ§ã«åä½ããããã§ãã ä¼çµ±ç㪠grep
              ã¸ç§»æ¤å¯è½ã§ãããã¨ãæå³ããã·ã§ã«ã¹ã¯ãªããã¯ã -q 㨠-s
              ã両æ¹ã¨ã使ããã«ãåºåã /dev/null ã¸ãªãã¤ã¬ã¯ããã¹ãã§ãã

       -U, --binary
              ãã¡ã¤ã«ããã¤ããªã¨ãã¦æ±ãã¾ããããã©ã«ãã§ã¯ãMS-DOS 㨠MS-Windows
              ç°å¢ä¸ã§ grep ã¯ããã¡ã¤ã«ããèªã¿åã£ãæåã® 32KB
              ã®å容ãè¦ã¦ããã¡ã¤ã«ã¿ã¤ããæ¨æ¸¬ãã¾ãã grep ã¯ãã¡ã¤ã«ããã‐
              ã¹ããã¡ã¤ã«ã¨å¤æããå ´åããªãªã¸ãã«ã®ãã¡ã¤ã«å容ãã ( ^ 㨠$
              ã使ããã¦ããæ£è¦è¡¨ç¾ãæ£ããåä½ãããããã« ) CR æåãåãé¤ãã¾ãã -U
              ãæå®ããã¨ããã®å½ã¦æ¨éãæå¶ãããã¹ã¦ã®ãã¡ã¤ã«ãèªã¿åã£ã¦
              ãããæ©æ§ã¸ãã®ã¾ã¾æ¸¡ãã¾ãããããã¡ã¤ã«ã åè¡ã®æ«å°¾ã« CR/LF
              ã®çµã¿ãæã¤ããã¹ããã¡ã¤ã«ãªãã ãã®ãªãã·ã§ã³ã¯æ‐
              £è¦è¡¨ç¾ãå½¹ã«ç«ããªãããããã¨ãããã§ãããã ãã®ãªãã·ã§ã³ã¯ MS-DOS 㨠MS-
              Windows 以å¤ã®ãã©ãããã©ã¼ã ã§ã¯ å¹æãããã¾ããã

       -u, --unix-byte-offsets
              unix å½¢å¼ã®ãã¤ãåä½ãªãã»ãããå ±åãã¾ãããã®ã¹ã¤ãããæå®ãã㨠grep
              ã¯ããã¡ã¤ã«ã unix å½¢å¼ã®ããã¹ããã¡ã¤ã«ã ããªãã¡ã CR æå‐
              ãåãé¤ããããã¡ã¤ã«ã§ãããã®ãã¨ãã« ãã¤ãåä½ãªãã»ãããå ±åãã¾ãã ãã®ãã¨ã¯
              grep ã Unix ãã·ã³ã§åä½ãããã®ã¨åãçµæãçæãã¾ãã ãã®ãªãã·ã§ã³ã¯ -b
              ãªãã·ã§ã³ã使ç¨ããªãéãå¹æãããã¾ããã MS-DOS 㨠MS-Windows
              以å¤ã®ãã©ãããã©ã¼ã ã§ã¯å¹æãããã¾ããã

       -V, --version
              grep ã®ãã¼ã¸ã§ã³çªå·ãæ¨æºã¨ã©ã¼åºåã«è¡¨ç¤ºãã¾ãããã°ã¬ãã¼ã
              ã«ã¯ããã®çªå·ãä»è¨ãã¦ãã ãã (ä¸è¨åç§)ã

       -v, --invert-match
              çµæãå転ãããããããªãã£ãè¡ãé¸æãã¾ãã

       -w, --word-regexp
              å®å¨ãªèªã«ãããããè¡ã®ã¿ãé¸æãã¾ãã ãããããé¨åæååãè¡é ããå§ã¾ã£ã¦ãããã
              åèªæ§ææå以å¤ã®æåãåã«ãããã¨ããã¹ãããã¾ãã åæ§ã«ããããããé¨åæå‐
              åãè¡æ«ã¾ã§ãããã åèªæ§ææå以å¤ã®æåãå¾ã«ããå¿è¦ãããã¾ãã åèªæ§ææå‐
              ã¨ã¯ãã¬ã¿ã¼ã»æ°åã»ã¢ã³ãã¹ã³ã¢ã§ãã

       -x, --line-regexp
              è¡å¨ä½ã¨æ£ç¢ºã«ãããããè¡ã®ã¿ãé¸æãã¾ãã

       -y     -i ã¨åãæå³ãæã¤æ§å¼ã®ãªãã·ã§ã³ã§ãã

       --null é常ãã¡ã¤ã«åã®å¾ã«ç¶ãæåã®ä»£ããã«ãã¤ã 0 (ASCII NUL æå) ãåºåãã¾ãã
              ä¾ãã°ã grep -l --null ã¯åãã¡ã¤ã«åã®å¾ã«ãé常㮠newline
              ã§ã¯ãªããã¤ã 0 ãåºåãã¾ãã ãã®ãªãã·ã§ã³ãæå®ããã¨ã newline ç‐
              ã®ä¾å¤çãªæåãå«ããã¡ã¤ã«åã«ç´é¢ããå ´åã§ã åºåãæç½ã«ãªãã¾ãã
              ãã®ãªãã·ã§ã³ã find -print0, perl -0, sort -z, xargs -0 ç‐
              ã®ã³ãã³ãã¨å±ã«ä½¿ç¨ããã°ãä»»æã®ãã¡ã¤ã«åãå¦çã§ãã¾ãã ãã¡ã¤ã«åã
              newline æåãå«ãã§ãã¦ãå¦çå¯è½ã§ãã

       -Z, --decompress
              æ¤ç´¢ãéå§ããåã«å¥åãã¼ã¿ã伸é·ãã¾ãã ãã®ãªãã·ã§ã³ã¯ zlib(3)
              ã©ã¤ãã©ãªã¨å±ã«ã³ã³ãã¤ã«ããå ´åã®ã¿ä½¿ç¨å¯è½ã§ãã -J,
              --bz2decompress æ¤ç´¢ãéå§ããåã«å¥åãã¼ã¿ã bzip2(1)
              ã使ç¨ãã¦ä¼¸é·ãã¾ãã

æ£è¦è¡¨ç¾
       æ£è¦è¡¨ç¾ã¯ãæååã®éåã表ç¾ãããã¿ã¼ã³ã®äºã§ããæ°å¼è¡¨ç¾ã¨åæ§ã«ã
       ããå°ããªè¡¨ç¾ãçµã¿åããããã¾ãã¾ãªæ¼ç®åãç¨ããäºã§ã æ£è¦è¡¨ç¾ãçµã¿ç«ã¦ã¾ãã

       grep ã¯ããåºæ¬ãæ£è¦è¡¨ç¾ã¨ ãæ¡å¼µãæ£è¦è¡¨ç¾ã® 2 種é¡ã®æ‐
       £è¦è¡¨ç¾ææ³ãæ±ãäºãã§ãã¾ãã GNU grep ã§ã¯ãã©ã¡ãã®æ‐
       £è¦è¡¨ç¾ææ³ãæ©è½çãªéãã¯ããã¾ããã ä»ã®å®è£ã§ã¯ãåºæ¬æ£è¦è¡¨ç¾ã¯æ¡å¼µæ‐
       £è¦è¡¨ç¾ããè½åãä½ããªã£ã¦ãã¾ãã ããã§ã¯ãæ¡å¼µæ£è¦è¡¨ç¾ã«ã¤ãã¦èª¬æãã¾ãã
       åºæ¬æ£è¦è¡¨ç¾ã¨ã®éãã¯ããã®å¾ã«èª¬æãã¾ãã

       æ£è¦è¡¨ç¾ã®åºæ¬åä½ã¯ã1 æåã«ãããããæ£è¦è¡¨ç¾ã§ãã ã¬ã¿ã¼ã¨æ°åãå«ãå¤ãã®æå‐
       ã¯ãããèªèº«ã«ãããããæ£è¦è¡¨ç¾ã§ãã ã¾ããç¹æ®ãªæå³ãæã¤ã¡ã¿æåãããã®æå‐
       ã®åã«ããã¯ã¹ã©ãã·ã¥ ãä»ããã¨ããã®æ¬æ¥ã®æåã«ãããããããã«ãªãã¾ãã

       è§æ¬å¼§å¼ ã¯ã [ 㨠] ã§å²ã¾ããæåã®ãªã¹ãã§ãã ããã¯ããã®ãªã¹ãä¸ã«å«ã¾ããã©ãã
       1 æåã«ããããã¾ãã ãã ãããªã¹ãã®åé ããã£ã¬ãã ^ ã®å ´åã¯ããã®ãªã¹ãã«å«ã¾ã ãªã
       æåã«ããããã¾ãã ä¾ãã°ãæ£è¦è¡¨ç¾ [0123456789] ã¯æ°å 1 æåã«ããããã¾ãã

       è§æ¬å¼§å¼åã§ã ç¯å²å¼ ã¯ãã¤ãã³ã§åãããã 2 æåã§æ§æããã¾ãã ããã¯ãã‐
       ã±ã¼ã«ã®ç§åé åºãæåéåãç¨ãã¦ã ãã® 2 æåãå«ã¿ããã®éã«ä¸¦ã¶ 1 æå‐
       ã«ããããããã®ã§ãã ä¾ãã°ãããã©ã«ãã® C ãã±ã¼ã«ã§ã¯ã [a-d] 㯠[abcd] ã¨ç‐
       価ã§ãã å¤ãã®ãã±ã¼ã«ã§ã¯æåãè¾æ¸é ã«ä¸¦ã¹ã¦ããããã®ãããªãã±ã¼ã«ã§ã¯ã [a-d]
       ã¯ä¸è¬çã« [abcd] ã¨ç価ã§ã¯ãªããä¾ãã° [aBbCcDd] ã¨ç価ããããã¾ããã
       è§æ¬å¼§å¼ã®å¤å¸çãªè§£éã使ç¨ããã«ã¯ã LC_ALL ç°å¢å¤æ°ã«å¤ C ãè¨å®ããC ã‐
       ã±ã¼ã«ã使ç¨ãã¦ãã ããã

       æå¾ã«ãç¹å®ã®ååãæã¤æåã¯ã©ã¹ããè§æ¬å¼§å¼ã«ã¦
       以ä¸ã®ããã«ãããããå®ç¾©ããã¦ãã¾ãã [:alnum:], [:alpha:], [:cntrl:],
       [:digit:], [:graph:], [:lower:], [:print:], [:punct:], [:space:],
       [:upper:], [:xdigit:] ä¾ãã°ã [[:alnum:]] 㯠[0-9A-Za-z], ã¨åãã§ãããå¾èã
       C ãã±ã¼ã«ã ASCII æå符å·åã« ä¾åããã®ã«å¯¾ãã¦ãåèã¯ãã±ã¼ã«ãæåéåã«ä¾åãã¾ããã
       (ã¯ã©ã¹åã®ä¸ã®è§æ¬å¼§ã¯ã·ã³ãã«åã®ä¸é¨ã§ããã
       ãªã¹ããåºåãè§æ¬å¼§ã¨ã¯å¥ã«æå®ããå¿è¦ããããã¨ã«æ³¨æ) ãªã¹ãã®ä¸‐
       ã§ã¯ãã»ã¨ãã©ã®ã¡ã¿æåã¯é常ã®æåã¨ãã¦æ±ããã¾ãã ãªãã©ã« ] ãå«ããã«ã¯ããã®æå‐
       ããªã¹ãã®åé ã«ç½®ãã¦ãã ãããåæ§ã«ããªãã©ã« ^ ãå«ããã«ã¯ããã®æå‐
       ããªã¹ãã®åé 以å¤ã«ç½®ãã¦ãã ããããªãã©ã« - ãå«ããã«ã¯ããã®æå‐
       ããªã¹ãã®æå¾ã«ç½®ãã¦ãã ããã

       ããªãªã .  ã¯ãä»»æã® 1 æåã«ããããã¾ãã ã·ã³ãã« \w 㯠[[:alnum:]] ã¨åãæå³ã§ã
       ã·ã³ãã« \W 㯠[^[:alnum:]] ã¨åãæå³ã§ãã

       ãã£ã¬ãã ^ ã¨ã ãã«è¨å· $ ã¯ãããããè¡é ã¨è¡æ«ã®ç©ºæååã«ãããããã¡ã¿æåã§ãã
       ã·ã³ãã« \< ã¨ã·ã³ãã« \> ã¯ãããããåèªã®åé ã¨æ«å°¾ã®ç©ºæååã«ãããããã¡ã¿æåã§ãã
       ã·ã³ãã« \b ã¯åèªã®ç«¯ã®ç©ºæååã«ããããã¾ãã ã·ã³ãã« \B ã¯åèªã®ç«¯ 以å¤
       ã®ç©ºæååã«ããããã¾ãã

       æ£è¦è¡¨ç¾ã®å¾ã«ã¯ãç¹°ãè¿ãæ¼ç®åã®ã©ãããç¶ããã¨ãããã¾ãã
       ?      ç´åã®é ç®ã¯ãªãã·ã§ã³ã§ãããæ大 1 åããããã¾ãã
       *      ç´åã®é ç®ã¯ 0 å以ä¸ããããã¾ãã
       +      ç´åã®é ç®ã¯ 1 å以ä¸ããããã¾ãã
       {n}    ç´åã®é ç®ã¯å³å¯ã« n åããããã¾ãã
       {n,}   ç´åã®é ç®ã¯ n å以ä¸ããããã¾ãã
       {n,m}  ç´åã®é ç®ã¯ãæä½ n åãæ大 m åããããã¾ãã

       2 ã¤ã®æ£è¦è¡¨ç¾ã¯çµåå¯è½ã§ãã çµæã¨ãã¦ã§ããããæ£è¦è¡¨ç¾ã¯ã çµåããã 2
       ã¤ã®é¨å表ç¾ã«ããããããããã 2 ã¤ã®é¨åæååãçµåããä»»æã®æååã«ããããã¾ãã

       2 ã¤ã®æ£è¦è¡¨ç¾ã¯ä¸ç½®ãåæ¼ç®å | ã§ç¹ããã¨ãå¯è½ã§ãã çµæã¨ãã¦ã§ããããæ‐
       £è¦è¡¨ç¾ã¯ã ã©ã¡ããã®é¨å表ç¾ã«ãããããä»»æã®æååã«ããããã¾ãã

       ç¹°ãè¿ãã¯çµåã«åªåãã¾ããã¾ãçµåã¯é¸æã«åªåãã¾ãã ãããã®åªåè¦åãç¡å¹ã¨ããããã«ã
       é¨å表ç¾å¨ä½ãæ¬å¼§ã§å²ããã¨ãå¯è½ã§ãã

       n ã 1 ã¤ã®æ°åã§ãããã㪠å¾æ¹åç§ \n ã¯ãæ£è¦è¡¨ç¾ä¸ã®æ¬å¼§ã§å²ã¾ãã n
       çªç®ã®é¨å表ç¾ããããããæååã¨ããããã¾ãã

       åºæ¬æ£è¦è¡¨ç¾ã§ã¯ãã¡ã¿æå ?, +, {, |, (, )
       ã¯ããã®ç¹æ®ãªæå³ã失ãã¾ãã代ããã«ãããã¯ã¹ã©ãã·ã¥ãä»ãã \?, \+, \{, \|, \(,
       \) ã使ç¨ãã¦ãã ããã

       ä¼çµ±ç㪠egrep ã¯ãã¡ã¿æå { ããµãã¼ããã¾ããã§ãããã¾ãããã®ã¡ã¿æåã®ä»£ããã« \{
       ããµãã¼ããã egrep å®è£ãããã¤ãåå¨ããã®ã§ã移æ¤å¯è½ãªã¹ã¯ãªããã§ã¯ã ãªãã©ã« {
       ã«ããããããããã« egrep ãã¿ã¼ã³ã§ { ã使ããã¨ã¯é¿ã㦠[{] ã使ãã¹ãã§ãã

       GNU egrep ã¯ã { ãä¸æ£ãªç¯å²æå®ã®å§ã¾ãã§ãããªãç¹æ®æåã§ã¯ãªããã¨æ³å®ãã¦ã
       ä¼çµ±çãªä½¿ç¨æ³ã®ãµãã¼ãã試ã¿ã¾ãã ä¾ãã°ãã·ã§ã«ã³ãã³ã egrep '{1' ã¯æ‐
       £è¦è¡¨ç¾ã®ææ³ã¨ã©ã¼ãå ±åããã«ã2 æåã®æåå {1 ãæ¤ç´¢ãã¾ãã POSIX.2
       ã¯ããã®åä½ãä¸ã¤ã®æ¡å¼µã¨ãã¦è¨±å¯ãã¦ãã¾ããã
       移æ¤å¯è½ãªã¹ã¯ãªããã§ã¯ãã®ä½¿ç¨æ³ãé¿ããã¹ãã§ãã

ç°å¢å¤æ°
       grep ã®åä½ã¯ã以ä¸ã®ç°å¢å¤æ°ã«ãã£ã¦å½±é¿ãåãã¾ãã

       ãã±ã¼ã« LC_foo ã¯ã以ä¸ã® 3 ã¤ã®ç°å¢å¤æ° LC_ALL, LC_foo, LANG
       ããã®é çªã§æ¤æ»ãããäºã«ãã£ã¦ãæå®ããã¾ãã ãããã®å¤æ°ã®ä¸ã§æåã«è¨‐
       å®ããã¦ãããã®ã«ãã£ã¦ããã±ã¼ã«ãæå®ããã¾ãã ä¾ãã°ã LC_ALL ãè¨å®ããã¦ãããã
       LC_MESSAGES ã pt_BR ã«è¨å®ããã¦ããå ´åã ãã©ã¸ã«ã®ãã«ãã¬ã«èªã LC_MESSAGES
       ãã±ã¼ã«ã«å¯¾ãã¦ä½¿ç¨ããã¾ãã ãããã®ç°å¢å¤æ°ãã©ããè¨å®ããã¦ããªãã£ããã ãããã¯ã‐
       ã±ã¼ã«ã®ã«ã¿ãã°ãã¤ã³ã¹ãã¼ã«ããã¦ããªãã£ããã ã¾ã grep ãåå½èªãµãã¼ã (NLS)
       ãªãã§ã³ã³ãã¤ã«ããã¦ããå ´åã C ãã±ã¼ã«ã使ç¨ããã¾ãã

       GREP_OPTIONS
              ãã®å¤æ°ã¯æ示çãªãªãã·ã§ã³ã®åã«æå®ãããããã©ã«ããªãã·ã§ã³ã
              æå®ãã¾ããä¾ãã°ããã GREP_OPTIONS ã '--binary-files=without-match
              --directories=skip' ã§ããå ´åã grep 㯠2 ã¤ã®ãªãã·ã§ã³ --binary-
              files=without-match 㨠--directories=skip
              ãæ示çãªãªãã·ã§ã³ã®åã«æå®ããã¦ããæ§ã«åä½ãã¾ãã
              ãªãã·ã§ã³ã®æå®ã¯ç©ºç½ã«ãã£ã¦åºåããã¾ãã ããã¯ã¹ã©ãã·ã¥ã¯æ¬¡ã®æå‐
              ãã¨ã¹ã±ã¼ããã¾ãã
              ããã¯ç©ºç½ãããã¯ã¹ã©ãã·ã¥ãå«ããªãã·ã§ã³ãæå®ããããã«ç¨ãããã¾ãã

       GREP_COLOR
              ãã¤ã©ã¤ããããã¼ã«ãæå®ãã¾ãã

       LC_ALL, LC_COLLATE, LANG
              ãããã®å¤æ°ã¯ã [a-z] ã®ãããªç¯å²å¼ã解éããéã®åç§é åºã決å®ãã
              LC_COLLATE ãæå®ãã¾ãã

       LC_ALL, LC_CTYPE, LANG
              ãããã®å¤æ°ã¯ã ä¾ãã°ã©ã®æåã空ç½ã§ããããªã©ãæåã®ç¨®é¡ã決å®ãã
              LC_CTYPE ãæå®ãã¾ãã

       LC_ALL, LC_MESSAGES, LANG
              ãããã®å¤æ°ã¯ã grep ã®åºãã¡ãã»ã¼ã¸ã®è¨èªã決å®ãã LC_MESSAGES
              ãæå®ãã¾ãã ããã©ã«ãã® C ã‐
              ã±ã¼ã«ã¯ãã¢ã¡ãªã«è±èªã®ã¡ãã»ã¼ã¸ã使ç¨ãã¾ãã

       POSIXLY_CORRECT
              è¨å®ããã¦ããå ´åã grep 㯠POSIX.2 ã¨ãã¦åä½ãããã以å¤ã®å ´å㯠grep
              ã¯ä»ã® GNU ããã°ã©ã ã®ããã«åä½ãã¾ãã POSIX.2
              ã§ã¯ãã¡ã¤ã«åã®å¾ã«ç¶ããªãã·ã§ã³ã¯ ãã¡ã¤ã«åã¨ãã¦æ±ããã¾ãã
              ããã©ã«ãã§ã¯ããã®ãããªãªãã·ã§ã³ã¯ãªãã©ã³ããªã¹ãã®åé ã«
              並ã³å¤ãããã¦ããªãã·ã§ã³ã¨ãã¦æ±ããã¾ãã ã¾ããPOSIX.2 ã§ã¯èªè‐
              ã§ããªããªãã·ã§ã³ã¯ “ ä¸æ³ (illegal)” ã§ããã¨è¨ºæããã¾ããã
              æ³å¾ã«éåãã¦ããããã§ã¯ãªãã®ã§ã ããã©ã«ãã§ã¯ããã㯓ä¸æ£ (invalid)”
              ã§ããã¨è¨ºæããã¾ãã

診æ
       é常ãé¸æãããè¡ãè¦ã¤ãã£ãå ´å㯠0 ãã è¦ã¤ãããªãã£ãå ´å㯠1 ãè¿ãã¾ãã
       ã¨ã©ã¼ãçããå ´å 2 ãè¿ãã¾ããã -q ã --quiet ã --silent
       ãªãã·ã§ã³ãæå®ããã¦ãããé¸æãããè¡ãè¦ã¤ãã£ãå ´åã¯ã ãã®éãã§ã¯ããã¾ããã

ãã°
       ãã°ã¬ãã¼ãã¯ã bug-gnu-utils@gnu.org ã¾ã§ Email ãã¦ãã ããã ãã®æã“Subject:”
       ã®ã©ããã« “grep” ã¨ããåèªã å¿ããã«å¥ãã¦ãã ããã

       {n,m} ã®è¡¨ç¾ã§é常ã«å¤§ããªç¹°ãè¿ããæå®ããã¨ãé常ã«å¤ãã®ã¡ã¢ãªãæ¶è²»ãã¾ãã
       ããã«ããã種ã®ããã¾ããªæ£è¦è¡¨ç¾ãæå®ããã¨ãå¿è¦ã¨ãªãæéã¨ã¡ã¢ãªé åã¯
       ææ°çã«å¢å¤§ãã grep ãã¡ã¢ãªä¸è¶³ãèµ·ããå¯è½æ§ãããã¾ãã

       å¾æ¹åç§ã¯é常ã«åä½ãéããå¿è¦ã¨ãªãæéã¯ææ°çã«å¢å¤§ãã¾ãã



GNU Project                       2002/01/22                           GREP(1)