5 . if \w'\(lq' .ds lq "\(lq
9 . if \w'\(rq' .ds rq "\(rq
13 .ie \n[.g] .mso www.tmac
16 \\$2 \(laemail: \\$1 \(ra\\$3
19 \\$2 \(laURL: \\$1 \(ra\\$3
25 .\" About Japanese translation
26 .\" The original version was contributed to Linux JM project
27 .\" by FreeBSD jpman Project.
28 .\" It contained these lines:
29 .\" %FreeBSD: src/gnu/usr.bin/grep/grep.1,v 1.16.2.3 2001/11/27 08:25:45 ru Exp %
30 .\" .Id %Id: grep.1,v 1.3 2000/06/09 21:58:50 horikawa Exp %
31 .\" Updated and Modified (grep-2.6.3) Thu Nov 11 11:44:47 JST 2010
32 .\" by Chonan Yoichi <cyoichi@maple.ocn.ne.jp>
33 .\" Updated and Modified (grep-2.27) Thu Feb 25 2017
34 .\" by Masakazu Takahashi <emasaka@gmail.com>
36 .TH GREP 1 \*(Dt "GNU grep 2.27" "User Commands"
41 .\"O grep, egrep, fgrep \- print lines matching a pattern
42 grep, egrep, fgrep \- パターンにマッチする行を表示する
63 .\"O searches the named input
65 .\"O for lines containing a match to the given
67 .\"O If no files are specified, or if the file
68 .\"O .RB "\*(lq" \- "\*(rq"
71 .\"O searches standard input.
74 .\"O prints the matching lines.
78 で名前を指定されたファイルを検索して、与えられた
83 .RB "\*(lq" \- "\*(rq"
91 .\"O In addition, two variant programs
96 .\"O .BR "grep\ \-E" ,
98 .\"O .BR "grep\ \-F" ,
109 .\"O These variants are deprecated, but are provided for backward compatibility.
111 これらの兄弟プログラムは非推奨ですが、後方互換性のために用意されています。
115 .\"O .SS "Generic Program Information"
119 .\"O Output a usage message and exit.
122 .BR \-V ", " \-\^\-version
123 .\"O Output the version number of
128 .\"O .SS "Matcher Selection"
131 .BR \-E ", " \-\^\-extended\-regexp
134 .\"O as an extended regular expression (ERE, see below).
136 を拡張正規表現 (ERE) として扱います (下記参照)。
138 .BR \-F ", " \-\^\-fixed\-strings
141 .\"O as a list of fixed strings (instead of regular expressions),
142 .\"O separated by newlines,
143 .\"O any of which is to be matched.
145 を改行で区切られた固定文字列 (正規表現のかわりに) のリストとして扱い、
146 その文字列のいずれかとマッチするかどうかを調べます。
148 .BR \-G ", " \-\^\-basic\-regexp
151 .\"O as a basic regular expression (BRE, see below).
152 .\"O This is the default.
154 を基本正規表現 (BRE) として扱います (下記参照)。これがデフォルトです。
156 .BR \-P ", " \-\^\-perl\-regexp
157 .\"O Interpret the pattern as a Perl-compatible regular expression (PCRE).
158 .\"O This is highly experimental and
160 .\"O may warn of unimplemented features.
161 パターンを Perl 互換の正規表現 (PCRE) として扱います。
164 を使うと、その機能は実装されていませんという
166 .\"O .SS "Matching Control"
169 .BI \-e " PATTERN" "\fR,\fP \-\^\-regexp=" PATTERN
175 .\"O If this option is used multiple times or is combined with the
177 .\"O .RB ( \-\-file )
178 .\"O option, search for all patterns given.
182 オプションと組み合わせたときは、与えられたすべてのパターンを検索します。
183 .\"O This option can be used to protect a pattern beginning with \*(lq\-\*(rq.
184 このオプションは、ハイフン \*(lq\-\*(rq
185 で始まるパターンを保護するのにも使えます。
187 .BI \-f " FILE" "\fR,\fP \-\^\-file=" FILE
188 .\"O Obtain patterns from
193 から 1 行 1 パターンとして読み込みます。
194 .\"O If this option is used multiple times or is combined with the
196 .\"O .RB ( \-\-regexp )
197 .\"O option, search for all patterns given.
201 オプションと組み合わせたときは、与えられたすべてのパターンを検索します。
202 .\"O The empty file contains zero patterns, and therefore matches nothing.
203 空のファイルはパターンを含まないので、何にもマッチしません。
205 .BR \-i ", " \-\^\-ignore\-case
206 .\"O Ignore case distinctions in both the
208 .\"O and the input files.
210 と入力ファイルの双方で、アルファベットの大文字と小文字を
213 .BR \-v ", " \-\^\-invert\-match
214 .\"O Invert the sense of matching, to select non-matching lines.
215 マッチの意味を逆にして、マッチしない行を抜き出して表示します。
217 .BR \-w ", " \-\^\-word\-regexp
218 .\"O Select only those lines containing matches that form whole words.
219 .\"O The test is that the matching substring must either be at the
220 .\"O beginning of the line, or preceded by a non-word constituent
222 .\"O Similarly, it must be either at the end of the line
223 .\"O or followed by a non-word constituent character.
224 .\"O Word-constituent characters are letters, digits, and the underscore.
225 マッチする部分が完全な単語を形成するときにのみ、その行を選択します。
226 次の条件を検査します。パターンにマッチする部分文字列は、行頭にあるか、
227 さもなければ、単語構成文字以外の文字の直後になければならない。
228 また、その部分文字列は、行末にあるか、さもなければ、単語構成文字以外の文字の
229 直前になければならない (訳注: ここで「完全な単語を形成する」というのは、
230 それが空白、改行、引用符、句読点などで前後を区切られた文字列だ
231 ということです。たとえば、文字列「A word with you」中の word という
232 部分文字列は完全な単語ですが、文字列「two words」中の部分文字列 word は
234 単語構成文字とは、アルファベット、数字、アンダスコアです
235 (訳注: 実は漢字や仮名も単語構成文字として扱われます)。
236 .\"O This option has no effect if
238 .\"O is also specified.
241 が同時に指定されたときには無効になります。
243 .BR \-x ", " \-\^\-line\-regexp
244 .\"O Select only those matches that exactly match the whole line.
245 パターンが行全体とぴったりマッチしたときにのみ、その行を選択します。
246 .\"O For a regular expression pattern, this is like parenthesizing the
247 .\"O pattern and then surrounding it with
251 正規表現でいうと、これはパターンを括弧で囲み、前後に
258 .\"O Obsolete synonym for
262 .\"O .SS "General Output Control"
265 .BR \-c ", " \-\^\-count
266 .\"O Suppress normal output; instead print a count of
267 .\"O matching lines for each input file.
269 .\"O .BR \-v ", " \-\^\-invert\-match
270 .\"O option (see below), count non-matching lines.
271 通常の出力はせず、各入力ファイルについてマッチした行数を表示します。
272 .BR \-v ", " \-\^\-invert-match
273 オプション (上記参照) と共に指定した場合は、
276 .BR \-\^\-color [ =\fIWHEN\fP "], " \-\^\-colour [ =\fIWHEN\fP ]
277 .\"O Surround the matched (non-empty) strings, matching lines, context lines,
278 .\"O file names, line numbers, byte offsets, and separators (for fields and
279 .\"O groups of context lines) with escape sequences to display them in color
280 .\"O on the terminal.
281 .\"O The colors are defined by the environment variable
282 .\"O .BR GREP_COLORS .
283 .\"O The deprecated environment variable
285 .\"O is still supported, but its setting does not have priority.
288 .\"O .BR never ", " always ", or " auto .
289 マッチした (空文字列ではない) 文字列、マッチする行、前後の文脈行、
290 ファイル名、行番号、バイトオフセット、(フィールドや、前後の文脈行を含む
291 グループ同士の) 区切り記号をエスケープ・シーケンスで囲み、ターミナル上に
297 も、これまでどおり使用できますが、その設定は優先されません。
300 .BR never ", " always ", " auto
303 .BR \-L ", " \-\^\-files\-without\-match
304 .\"O Suppress normal output; instead print the name
305 .\"O of each input file from which no output would
306 .\"O normally have been printed.
307 .\"O The scanning will stop on the first match.
310 を普通に実行した際に、何の検索結果も表示しないような入力ファイルの名前を
311 列挙します (訳注: すなわち、\fB\-L\fR オプションを指定すると、
312 \fB\-v\fR オプションを同時に指定しない場合は、パターンにマッチする
313 文字列を含む行がまったく存在しないファイルの名前を列挙するということです)。
314 個々のファイルに対する走査は、最初のマッチで終了します。
316 .BR \-l ", " \-\^\-files\-with\-matches
317 .\"O Suppress normal output; instead print
318 .\"O the name of each input file from which output
319 .\"O would normally have been printed.
320 .\"O The scanning will stop on the first match.
323 を普通に実行した際に、何らかの検索結果を表示するような入力ファイルの名前を
324 列挙します (訳注: すなわち、\fB\-l\fR オプションを指定すると、
325 \fB\-v\fR オプションを同時に指定しない場合は、パターンにマッチする
326 文字列を含む行が存在するファイルの名前を列挙するということです)。
327 個々のファイルに対する走査は、最初のマッチで終了します。
329 .BI \-m " NUM" "\fR,\fP \-\^\-max\-count=" NUM
330 .\"O Stop reading a file after
333 .\"O If the input is standard input from a regular file,
336 .\"O matching lines are output,
338 .\"O ensures that the standard input is positioned to just after the last
339 .\"O matching line before exiting, regardless of the presence of trailing
341 .\"O This enables a calling process to resume a search.
346 .\"O matching lines, it outputs any trailing context lines.
351 .\"O option is also used,
353 .\"O does not output a count greater than
358 .\"O .B \-\^\-invert\-match
359 .\"O option is also used,
361 .\"O stops after outputting
363 .\"O non-matching lines.
366 に達したら、ファイルの読み込みを中止します。
367 入力が通常ファイルから標準入力を介して行われている場合は、マッチした行を
371 は標準入力の読み出し位置を最後にマッチした行の直後に来るようにしてから、
372 終了します。続いて表示する文脈行がある場合でも、この動作は変わりません。
375 を呼び出すプロセスが、中止したところから検索を
380 に達してストップしたとき、それに続く文脈行があれば、それを出力します。
391 .B \-\^\-invert\-match
398 .BR \-o ", " \-\^\-only\-matching
399 .\"O Print only the matched (non-empty) parts of a matching line,
400 .\"O with each such part on a separate output line.
401 マッチする行のマッチした部分だけを (それが空文字列でなければ) 表示します。
402 マッチした各文字列は、それぞれ別の行に書き出します。
404 .BR \-q ", " \-\^\-quiet ", " \-\^\-silent
405 .\"O Quiet; do not write anything to standard output.
406 .\"O Exit immediately with zero status if any match is found,
407 .\"O even if an error was detected.
411 .\"O .B \-\^\-no\-messages
413 沈黙モードです。標準出力に何も書き出しません。
414 マッチするものが 1 つでも見つかると、エラーを検出していた場合でも、
418 .B \-\^\-no\-messages
421 .BR \-s ", " \-\^\-no\-messages
422 .\"O Suppress error messages about nonexistent or unreadable files.
423 ファイルが存在しないことや読み込みめないことを示す
425 .\"O .SS "Output Line Prefix Control"
426 .SS "出力する行の前に付ける情報の制御"
428 .BR \-b ", " \-\^\-byte\-offset
429 .\"O Print the 0-based byte offset within the input file
430 .\"O before each line of output.
433 .\"O .RB ( \-\^\-only\-matching )
435 .\"O print the offset of the matching part itself.
436 出力する各行の前に、その入力ファイル内での 0 から始まる
439 .RB ( \-\^\-only\-matching )
440 も指定されているときは、マッチする部分そのもののオフセットを示します。
442 .BR \-H ", " \-\^\-with\-filename
443 .\"O Print the file name for each match.
444 .\"O This is the default when there is more than one file to search.
445 各々のマッチに対してそのファイル名を表示します。
446 検索するファイルが 2 個以上の場合は、これがデフォルトの動作です。
448 .BR \-h ", " \-\^\-no\-filename
449 .\"O Suppress the prefixing of file names on output.
450 .\"O This is the default when there is only one file
451 .\"O (or only standard input) to search.
452 出力する行の前にファイル名を付けないようにします。
453 検索するファイルが 1 つしかない (あるいは、標準入力だけだった) 場合は、
456 .BI \-\^\-label= LABEL
457 .\"O Display input actually coming from standard input as input coming from file
459 .\"O This is especially useful when implementing tools like
462 .\"O .BR "gzip -cd foo.gz | grep --label=foo -H something" .
468 というファイルから来たもののように見せかけます。
471 のようなツールを自分で作成する際にとりわけ便利です。たとえば、
472 .BR "gzip -cd foo.gz | grep --label=foo -H something"
477 .BR \-n ", " \-\^\-line\-number
478 .\"O Prefix each line of output with the 1-based line number
479 .\"O within its input file.
480 各出力行の前に、その入力ファイル内での 1 から始まる行番号を表示します。
482 .BR \-T ", " \-\^\-initial\-tab
483 .\"O Make sure that the first character of actual line content lies on a
484 .\"O tab stop, so that the alignment of tabs looks normal.
485 .\"O This is useful with options that prefix their output to the actual content:
489 .\"O In order to improve the probability that lines
490 .\"O from a single file will all start at the same column,
491 .\"O this also causes the line number and byte offset (if present)
492 .\"O to be printed in a minimum size field width.
493 行の実際の内容をなす最初の文字が、必ずタブ・ストップの位置に
494 来るようにします。その結果、タブがきちんと揃って見えるようになります。
497 といった、実際の内容の前に情報を付加するオプションを使うときに
500 1 つのファイルから抜き出した行の先頭ができるだけ揃うように、
501 行番号やバイトオフセットがある場合は、そのフィールド幅を
504 .BR \-u ", " \-\^\-unix\-byte\-offsets
505 .\"O Report Unix-style byte offsets.
506 .\"O This switch causes
508 .\"O to report byte offsets as if the file were a Unix-style text file,
509 .\"O i.e., with CR characters stripped off.
510 .\"O This will produce results identical to running
512 .\"O on a Unix machine.
513 .\"O This option has no effect unless
515 .\"O option is also used;
516 .\"O it has no effect on platforms other than \s-1MS-DOS\s0 and \s-1MS\s0-Windows.
517 Unix 形式のバイトオフセットを報告します。
520 は、検索対象のファイルが Unix 形式のテキストファイルであるかのように、
521 バイトオフセットを報告します。すなわち、CR 文字を切り捨てるのです。
522 そのため、表示される結果は、Unix マシンで
527 オプションを同時に使用しないかぎり、効果がありません。
528 また、このオプションは、\s-1MS-DOS\s0 と \s-1MS\s0-Windows 以外の
529 プラットホームでは、何の効果もありません。
531 .BR \-Z ", " \-\^\-null
532 .\"O Output a zero byte (the \s-1ASCII\s0
534 .\"O character) instead of the character that normally follows a file name.
537 .\"O outputs a zero byte after each file name instead of the usual newline.
538 .\"O This option makes the output unambiguous, even in the presence of file
539 .\"O names containing unusual characters like newlines.
540 .\"O This option can be used with commands like
541 .\"O .BR "find \-print0" ,
542 .\"O .BR "perl \-0" ,
543 .\"O .BR "sort \-z" ,
546 .\"O to process arbitrary file names,
547 .\"O even those that contain newline characters.
548 ファイル名に続いて通常出力される文字の代わりに、
549 値が 0 の 1 バイト (\s-1ASCII\s0
554 は、いつもの改行 (newline) ではなく、値が 0 の 1 バイトを各ファイル名の後ろに
556 このオプションは、改行のような変わった文字を含むファイル名があるときでも、
559 .BR "find \-print0" ,
563 などのコマンドと組み合わせて使うと、行儀の悪いファイル名も
565 ファイル名が改行文字を含んでいても処理できるのです。
566 .\"O .SS "Context Line Control"
569 .BI \-A " NUM" "\fR,\fP \-\^\-after\-context=" NUM
572 .\"O lines of trailing context after matching lines.
573 .\"O Places a line containing a group separator
575 .\"O between contiguous groups of matches.
579 .\"O .B \-\^\-only\-matching
580 .\"O option, this has no effect and a warning is given.
582 で指定した行数だけ、パターンにマッチした行の後に続く文脈も表示します。
583 マッチした行を含むグループ同士の間には、グループを区切る印
588 .B \-\^\-only\-matching
589 と同時に使うと、このオプションは効果がなく、警告メッセージを出します。
591 .BI \-B " NUM" "\fR,\fP \-\^\-before\-context=" NUM
594 .\"O lines of leading context before matching lines.
595 .\"O Places a line containing a group separator
597 .\"O between contiguous groups of matches.
601 .\"O .B \-\^\-only\-matching
602 .\"O option, this has no effect and a warning is given.
604 で指定した行数だけ、パターンにマッチした行に先行する文脈も表示します。
605 マッチした行を含むグループ同士の間には、グループを区切る印
610 .B \-\^\-only\-matching
611 と同時に使うと、このオプションは効果がなく、警告メッセージを出します。
613 .BI \-C " NUM" "\fR,\fP \-" NUM "\fR,\fP \-\^\-context=" NUM
616 .\"O lines of output context.
617 .\"O Places a line containing a group separator
619 .\"O between contiguous groups of matches.
623 .\"O .B \-\^\-only\-matching
624 .\"O option, this has no effect and a warning is given.
626 で指定した行数だけ、パターンにマッチした行の前後の文脈も表示します。
627 マッチした行を含むグループ同士の間には、グループを区切る印
632 .B \-\^\-only\-matching
633 と同時に使うと、このオプションは効果がなく、警告メッセージを出します。
634 .\"O .SS "File and Directory Selection"
637 .BR \-a ", " \-\^\-text
638 .\"O Process a binary file as if it were text; this is equivalent to the
639 .\"O .B \-\^\-binary\-files=text
641 バイナリファイルをテキストファイルであるかのように処理します。
643 .B \-\^\-binary-files=text
646 .BI \-\^\-binary\-files= TYPE
647 .\"O If a file's data or metadata
648 .\"O indicate that the file contains binary data,
649 .\"O assume that the file is of type
652 ファイルにバイナリデータが含まれていることを示す場合に、
656 .\"O Non-text bytes indicate binary data; these are either output bytes that are
657 .\"O improperly encoded for the current locale, or null input bytes when the
659 .\"O option is not given.
661 テキストではないバイトが見つかれば、バイナリデータです。
663 現在使用しているロケールに不適切にエンコードして出力されたバイトや、
665 オプションが指定されていないときの入力中のヌルバイトだということもあります。
673 .\"O discovers that a file is binary it suppresses any further output, and
674 .\"O instead outputs either a one-line message saying that a binary file
675 .\"O matches, or no message if there is no match.
684 その先の出力を抑制します。そのかわりにバイナリファイルにマッチしたという
685 1 行のメッセージを表示します。マッチする部分がない場合には何も表示しません。
690 .\"O .BR without-match ,
693 .\"O discovers that a file is binary it assumes that the rest of the file
694 .\"O does not match; this is equivalent to the
703 はファイルがバイナリだとわかると、残りはマッチしないものと仮定します。
713 .\"O processes a binary file as if it were text; this is equivalent to the
722 はバイナリファイルをテキストであるかのように扱います。
732 .\"O may treat non-text bytes as line terminators even without the
734 .\"O option. This means choosing
738 .\"O can affect whether a pattern matches a file. For
747 .\"O immediately followed by a null byte, even though this
748 .\"O is not matched when
759 がなくてもテキスト以外の文字を行の区切りとして扱う場合があります。
765 パターンがファイルにマッチするかどうかに影響があることを意味します。
774 の直後に NULL 文字が続く箇所にマッチする可能性があるのに対し、
779 .\"O Conversely, when
785 .\"O (period) might not match a null byte.
793 (period) というパターンは NULL 文字にはマッチしないかもしれません。
798 .\"O option might output binary garbage,
799 .\"O which can have nasty side effects if the output is a terminal and if the
800 .\"O terminal driver interprets some of it as commands.
803 オプションはバイナリのゴミを出力するかもしれません。
805 端末ドライバがゴミの一部をコマンドだと解釈する場合には、
806 このゴミが厄介な副作用を起こす可能性があります。
807 .\"O On the other hand, when reading files whose text encodings are
808 .\"O unknown, it can be helpful to use
812 .\"O in the environment, in order to find more matches even if the matches
813 .\"O are unsafe for direct display.
814 一方、テキストのエンコーディングが不明なファイルを読み込むとき、
815 マッチした結果をそのまま表示するのが安全でなくても、
822 .BI \-D " ACTION" "\fR,\fP \-\^\-devices=" ACTION
823 .\"O If an input file is a device, FIFO or socket, use
830 .\"O which means that devices are read just as if they were ordinary files.
835 .\"O devices are silently skipped.
836 入力ファイルがデバイス、FIFO、ソケットのいづれかである場合に、
843 です。すなわち、デバイスなどを、それが普通のファイルであるかのように、
848 ならば、デバイスなどを黙ってスキップします。
850 .BI \-d " ACTION" "\fR,\fP \-\^\-directories=" ACTION
851 .\"O If an input file is a directory, use
858 .\"O i.e., read directories just as if they were ordinary files.
863 .\"O silently skip directories.
868 .\"O read all files under each directory, recursively,
869 .\"O following symbolic links only if they are on the command line.
870 .\"O This is equivalent to the
879 です。すなわち、ディレクトリを、それが普通のファイルであるかのように、
884 ならば、ディレクトリを黙ってスキップします。
891 は各ディレクトリの下にあるすべてのファイルを再帰的に読み込みます。
892 ただし、シンボリックリンクはコマンドラインで指定されたときにのみたどります。
897 .BI \-\^\-exclude= GLOB
898 .\"O Skip any command-line file with a name suffix that matches the pattern
900 .\"O using wildcard matching; a name suffix is either the whole
901 .\"O name, or any suffix starting after a
903 .\"O and before a +non-\fB/\fP.
904 コマンドラインで指定されているファイルについては、
914 以外の文字で終るファイル名の最後の部分のことです。
915 .\"O When searching recursively, skip any subfile whose base name matches
917 .\"O the base name is the part after the last
919 また、ディレクトリを再帰検索しているときに出会うファイルについては、
926 .\"O A pattern can use.\"O .\"O .BR * ,
930 .\"O as wildcards, and
932 .\"O to quote a wildcard or backslash character literally.
940 ワイルドカード文字やバックスラッシュ文字を本来の意味で使用できます。
942 .BI \-\^\-exclude-from= FILE
943 .\"O Skip files whose base name matches any of the file-name globs read from
945 .\"O (using wildcard matching as described under
946 .\"O .BR \-\^\-exclude ).
949 を読み込み、そこに書かれているファイル名 (ワイルドカード可) のどれかに
950 ベースネームがマッチするファイルをスキップします
952 の項で説明したワイルドカードのマッチングを使用します)。
954 .BI \-\^\-exclude-dir= GLOB
955 .\"O Skip any command-line directory with a name suffix that matches the
958 コマンドラインで指定されているディレクトリのうち、
961 にマッチするディレクトリをスキップします。
962 .\"O When searching recursively, skip any subdirectory
963 .\"O whose base name matches
965 また、ディレクトリを再帰検索しているときに出会うサブディレクトリについては、
968 にマッチするサブディレクトリをスキップします。
969 .\"O Ignore any redundant trailing slashes in
975 .\"O Process a binary file as if it did not contain matching data; this is
976 .\"O equivalent to the
977 .\"O .B \-\^\-binary\-files=without-match
979 バイナリファイルをマッチするデータを含んでいないものとして
981 .B \-\^\-binary\-files=without-match
984 .BI \-\^\-include= GLOB
985 .\"O Search only files whose base name matches
987 .\"O (using wildcard matching as described under
988 .\"O .BR \-\^\-exclude ).
993 の項で説明したワイルドカードのマッチングを使用します)。
995 .BR \-r ", " \-\^\-recursive
996 .\"O Read all files under each directory, recursively,
997 .\"O following symbolic links only if they are on the command line.
998 各ディレクトリの下にあるすべてのファイルを再帰的に読み込みます。
999 ただし、シンボリックリンクはコマンドラインで指定されたときにのみたどります。
1000 .\"O Note that if no file operand is given, grep searches the working directory.
1001 検索対象のファイルが指定されなかった場合には
1002 grep は現在のディレクトリを探すことに注意してください。
1003 .\"O This is equivalent to the
1004 .\"O .B "\-d recurse"
1010 .BR \-R ", " \-\^\-dereference\-recursive
1011 .\"O Read all files under each directory, recursively.
1012 .\"O Follow all symbolic links, unlike
1014 各ディレクトリの下にあるすべてのファイルを再帰的に読み込みます。
1016 と異なり、すべてのシンボリックリンクを追跡します。
1017 .\"O .SS "Other Options"
1020 .BR \-\^\-line\-buffered
1021 .\"O Use line buffering on output.
1022 .\"O This can cause a performance penalty.
1026 .BR \-U ", " \-\^\-binary
1027 .\"O Treat the file(s) as binary.
1029 .\"O By default, under \s-1MS-DOS\s0 and \s-1MS\s0-Windows,
1031 .\"O guesses the file type by looking at the contents of the first 32KB
1032 .\"O read from the file.
1033 MS-DOS や MS-Windows の環境下で、
1037 .B \-\^\-binary\-files
1038 オプションで記述された方法で推測します。
1041 .\"O decides the file is a text file, it strips the CR characters from the
1042 .\"O original file contents (to make regular expressions with
1046 .\"O work correctly).
1048 はファイルをテキストファイルと判断した場合、オリジナルのファイル内容から
1052 を使った正規表現が正しく動作するように)
1056 .\"O overrules this guesswork, causing all files to be read and passed to the
1057 .\"O matching mechanism verbatim; if the file is a text file with CR/LF
1058 .\"O pairs at the end of each line, this will cause some regular
1059 .\"O expressions to fail.
1061 を指定すると、この推測を抑制し、すべてのファイルを読み取って、
1062 そのまま手を加えずにマッチ処理へ渡すのです。もしファイルが
1063 各行の末尾に CR/LF の組み合わせを持つテキストファイルなら、
1064 このオプションのせいで正規表現がうまく働かないことがあるかもしれません。
1065 .\"O This option has no effect on platforms
1066 .\"O other than \s-1MS-DOS\s0 and \s-1MS\s0-Windows.
1067 このオプションは MS-DOS や MS-Windows 以外のプラットフォームでは
1070 .BR \-z ", " \-\^\-null\-data
1071 .\"O Treat input and output data as sequences of lines, each terminated by
1072 .\"O a zero byte (the ASCII NUL character) instead of a newline.
1075 値が 0 のバイト (ASCII NULL 文字) で区切られた一連の行として扱います。
1080 .\"O option, this option can be used with commands like
1082 .\"O to process arbitrary file names.
1090 行儀の悪いファイル名の処理に使用することができます。
1091 .\"O .SH "REGULAR EXPRESSIONS"
1093 .\"O A regular expression is a pattern that describes a set of strings.
1094 .\"O Regular expressions are constructed analogously to arithmetic
1095 .\"O expressions, by using various operators to combine smaller expressions.
1097 正規表現とは、一群の文字列を一まとめにして表現するパターンのことです。
1098 正規表現の構成方法は、数式によく似ています。すなわち、さまざまな演算子を
1099 使い、小さな表現を組み合わせて構成するのです。
1102 .\"O understands three different versions of regular expression syntax:
1103 .\"O \*(lqbasic\*(rq (BRE), \*(lqextended\*(rq (ERE) and \*(lqperl\*(rq (PCRE).
1105 .\"O .RB "\s-1GNU\s0\ " grep ,
1106 .\"O there is no difference in available functionality between basic and
1107 .\"O extended syntaxes.
1108 .\"O In other implementations, basic regular expressions are less powerful.
1109 .\"O The following description applies to extended regular expressions;
1110 .\"O differences for basic regular expressions are summarized afterwards.
1111 .\"O Perl-compatible regular expressions give additional functionality, and are
1112 .\"O documented in pcresyntax(3) and pcrepattern(3), but only work if
1113 .\"O PCRE is available in the system.
1116 は、「基本」正規表現 (BRE)、「拡張」正規表現 (ERE)、「Perl の」正規表現
1117 (PCRE) という 3 種類の正規表現文法を扱うことができます。
1118 .RB "\s-1GNU\s0\ " grep
1119 では、「基本」と「拡張」の文法の間で、利用できる機能に違いはありません。
1120 他の実装では、基本正規表現は拡張正規表現ほど強力ではないものです。
1122 基本正規表現との相違については、後で簡単にまとめることにします。
1123 なお、Perl 互換の正規表現にはより多くの機能があり、
1124 pcresyntax(3) や pcrepattern(3) で詳細に解説されていますが、
1125 PCRE が用意されているシステムでしか利用できません。
1127 .\"O The fundamental building blocks are the regular expressions
1128 .\"O that match a single character.
1129 .\"O Most characters, including all letters and digits,
1130 .\"O are regular expressions that match themselves.
1131 .\"O Any meta-character with special meaning
1132 .\"O may be quoted by preceding it with a backslash.
1134 正規表現を構成する基本単位は、1 文字にマッチする正規表現です。
1135 アルファベットや数字を含むほとんどの文字が、自分自身にマッチする正規表現です。
1136 また、特殊な意味を持つメタ文字も、その文字の前にバックスラッシュ
1137 を付けると、その本来の文字にマッチするようになります。
1141 .\"O matches any single character.
1145 .\"O .SS "Character Classes and Bracket Expressions"
1146 .SS "文字クラスと角括弧式 (ブラケット式)"
1148 .\"O .I "bracket expression"
1149 .\"O is a list of characters enclosed by
1153 .\"O It matches any single
1154 .\"O character in that list; if the first character of the list
1157 .\"O then it matches any character
1160 .\"O For example, the regular expression
1161 .\"O .B [0123456789]
1162 .\"O matches any single digit.
1171 は、リスト中の任意の 1 文字にマッチします。
1174 の場合は、リスト中の文字以外の任意の 1 文字にマッチします。
1177 は任意の数字 1 個にマッチするわけです。
1179 .\"O Within a bracket expression, a
1180 .\"O .I "range expression"
1181 .\"O consists of two characters separated by a hyphen.
1182 .\"O It matches any single character that sorts between the two characters,
1183 .\"O inclusive, using the locale's collating sequence and character set.
1184 .\"O For example, in the default C locale,
1186 .\"O is equivalent to
1188 .\"O Many locales sort characters in dictionary order, and in these locales
1190 .\"O is typically not equivalent to
1192 .\"O it might be equivalent to
1193 .\"O .BR [aBbCcDd] ,
1195 .\"O To obtain the traditional interpretation of bracket expressions,
1196 .\"O you can use the C locale by setting the
1198 .\"O environment variable to the value
1203 を置くことができますが、これはハイフンで区切られた 2 つの文字から
1204 なっています。範囲式は、現在使用中のロケールにおける照合順序と
1205 文字集合を使ったときに、その 2 文字の間に並ぶ、その 2 文字を含む
1207 たとえば、デフォルトの C ロケールでは、
1212 多くのロケールでは文字を辞書式の順序で並べていますが、そうしたロケールで
1220 角括弧式を伝統的な意味に解釈させたいなら、
1225 に設定して、C ロケールを使用するとよいでしょう。
1227 .\"O Finally, certain named classes of characters are predefined within
1228 .\"O bracket expressions, as follows.
1229 .\"O Their names are self explanatory, and they are
1230 .\"O .BR [:alnum:] ,
1231 .\"O .BR [:alpha:] ,
1232 .\"O .BR [:cntrl:] ,
1233 .\"O .BR [:digit:] ,
1234 .\"O .BR [:graph:] ,
1235 .\"O .BR [:lower:] ,
1236 .\"O .BR [:print:] ,
1237 .\"O .BR [:punct:] ,
1238 .\"O .BR [:space:] ,
1239 .\"O .BR [:upper:] ,
1241 .\"O .BR [:xdigit:].
1244 .\"O means the character class of numbers and
1245 .\"O letters in the current locale. In the C locale and \s-1ASCII\s0
1246 .\"O character set encoding, this is the same as
1247 .\"O .BR [0\-9A\-Za\-z] .
1248 .\"O (Note that the brackets in these class names are part of the symbolic
1249 .\"O names, and must be included in addition to the brackets delimiting
1250 .\"O the bracket expression.)
1251 .\"O Most meta-characters lose their special meaning inside bracket expressions.
1252 .\"O To include a literal
1254 .\"O place it first in the list.
1255 .\"O Similarly, to include a literal
1257 .\"O place it anywhere but first.
1258 .\"O Finally, to include a literal
1261 最後に、角括弧式内で使えるように、特定の名前を持つ文字クラスが
1263 名前が内容を示しており、それは次のようなものです。
1278 現在のロケールの文字クラスで数字と文字を意味します。
1279 C ロケールや \s-1ASCII\s0 文字集合のエンコーディングの場合、
1283 (こうしたクラス名に使用されている角括弧は、シンボル名の一部なので、
1284 角括弧式の前後に付く角括弧とは別に指定する必要があることに
1286 角括弧式の内側では、ほとんどのメタ文字がその特別な意味を
1289 という記号そのものを角括弧式に含めるには、
1294 それを先頭以外のどこかに置けばよいでしょう。
1300 .SS "行頭と行末 (アンカリング)"
1303 .\"O and the dollar sign
1305 .\"O are meta-characters that respectively match the empty string at the
1306 .\"O beginning and end of a line.
1312 は、それぞれ行頭と行末の空文字列にマッチするメタ文字です。
1313 .\"O .SS "The Backslash Character and Special Expressions"
1314 .SS "バックスラッシュ付きの特別な表現"
1319 .\"O respectively match the empty string at the beginning and end of a word.
1322 .\"O matches the empty string at the edge of a word,
1325 .\"O matches the empty string provided it's
1327 .\"O at the edge of a word.
1330 .\"O is a synonym for
1331 .\"O .B [_[:alnum:]]
1334 .\"O is a synonym for
1335 .\"O .BR [^_[:alnum:]] .
1340 は、それぞれ単語の先頭と末尾の空文字列にマッチするメタ文字です。
1361 .\"O A regular expression may be followed by one of several repetition operators:
1362 正規表現の後には、繰り返し演算子のどれかが続くことがあります。
1366 .\"O The preceding item is optional and matched at most once.
1367 直前の項目があってもなくてもよく、マッチするとしても 1 回だけということ。
1370 .\"O The preceding item will be matched zero or more times.
1371 直前の項目が 0 回以上マッチするということ。
1374 .\"O The preceding item will be matched one or more times.
1375 直前の項目が 1 回以上マッチするということ。
1378 .\"O The preceding item is matched exactly
1386 .\"O The preceding item is matched
1394 .\"O The preceding item is matched at most
1400 .\"O This is a \s-1GNU\s0 extension.
1401 これは \s-1GNU\s0 拡張です。
1404 .\"O The preceding item is matched at least
1406 .\"O times, but not more than
1415 .\"O .SS Concatenation
1417 .\"O Two regular expressions may be concatenated; the resulting
1418 .\"O regular expression matches any string formed by concatenating
1419 .\"O two substrings that respectively match the concatenated
1421 2 つの正規表現は結合することができます。
1423 結合対象となる部分表現にそれぞれマッチする
1424 2 つの部分文字列を結合して作られる、どんな文字列にもマッチします。
1425 .\"O .SS Alternation
1427 .\"O Two regular expressions may be joined by the infix operator
1429 .\"O the resulting regular expression matches any string matching
1430 .\"O either alternate expression.
1435 どちらかの部分表現にマッチするどんな文字列にもマッチします。
1438 .\"O Repetition takes precedence over concatenation, which in turn
1439 .\"O takes precedence over alternation.
1440 .\"O A whole expression may be enclosed in parentheses
1441 .\"O to override these precedence rules and form a subexpression.
1442 繰り返しは結合に優先します。また結合は選択に優先します。
1443 表現の 1 つのまとまりを括弧でくくると、その内側の式をこうした優先規則より
1445 括弧でくくった部分は、1 つの部分表現になるのです。
1446 .\"O .SS "Back References and Subexpressions"
1448 .\"O The back-reference
1452 .\"O is a single digit, matches the substring
1453 .\"O previously matched by the
1455 .\"O parenthesized subexpression of the regular expression.
1462 番目の部分表現が前もってマッチした文字列とマッチします。
1463 .\"O .SS "Basic vs Extended Regular Expressions"
1465 .\"O In basic regular expressions the meta-characters
1473 .\"O lose their special meaning; instead use the backslashed
1490 は、その特殊な意味を失います。バックスラッシュを付けた
1499 .\"O .SH "ENVIRONMENT VARIABLES"
1501 .\"O The behavior of
1503 .\"O is affected by the following environment variables.
1509 .\"O The locale for category
1511 .\"O is specified by examining the three environment variables
1513 .\"O .BR LC_\fIfoo\fP ,
1516 .\"O The first of these variables that is set specifies the locale.
1517 .\"O For example, if
1519 .\"O is not set, but
1523 .\"O then the Brazilian Portuguese locale is used for the
1526 .\"O The C locale is used if none of these environment variables are set,
1527 .\"O if the locale catalog is not installed, or if
1529 .\"O was not compiled with national language support (\s-1NLS\s0).
1535 という 3 つの環境変数をこの順番で調べることで決まります。
1536 この 3 つの環境変数のうち、設定されている最初のものが、
1546 そのときは、ブラジルのポルトガル語というロケールが
1549 こうした環境変数がまったく設定されていなかったり、ロケールの
1550 カタログがインストールされていなかったり、
1552 が各国語サポート (\s-1NLS\s0) を有効にしてコンパイルされていなかったり
1553 した場合は、C ロケールが使用されます。
1554 .\"O The shell command
1555 .\"O .B "locale \-a"
1556 .\"O lists locales that are currently available.
1559 コマンドによって現在利用できるロケールが一覧できます。
1562 .\"O This variable specifies default options
1563 .\"O to be placed in front of any explicit options.
1564 .\"O As this causes problems when writing portable scripts,
1565 .\"O this feature will be removed in a future release of
1569 .\"O warns if it is used.
1570 .\"O Please use an alias or script instead.
1571 この変数ではデフォルトのオプションを指定します。そうしたオプションは
1572 コマンドラインで明示的に指定するオプションの前に置かれます。
1573 これが移植性の高いスクリプトを書くときに問題となるため、
1576 の将来のリリースで削除されることになっており、
1580 かわりにエイリアスやスクリプトを使ってください。
1583 .\"O This variable specifies the color used to highlight matched (non-empty) text.
1584 .\"O It is deprecated in favor of
1585 .\"O .BR GREP_COLORS ,
1586 .\"O but still supported.
1592 .\"O capabilities of
1594 .\"O have priority over it.
1595 .\"O It can only specify the color used to highlight
1596 .\"O the matching non-empty text in any matching line
1597 .\"O (a selected line when the
1599 .\"O command-line option is omitted,
1600 .\"O or a context line when
1605 .\"O which means a bold red foreground text on the terminal's default background.
1606 この変数は、パターンにマッチした (空文字列ではない) テキストを強調するために
1609 変数を使用する方が望ましく、この変数は非推奨なのですが、今でも
1616 機能を使用している場合は、この変数による指定より、そちらのほうが
1618 この変数によって指定できるのは、マッチする空文字列ではないテキストを
1619 強調するために、マッチする行ならどこでも使用する色彩だけなのです
1620 (マッチする行は、コマンドラインオプション
1622 を指定しなかったときは、選択される行になり、
1624 を指定したときは、前後の文脈行になります)。
1627 ですが、それはターミナルのデフォルトの背景色に赤い前景色の太字で
1631 .\"O Specifies the colors and other attributes
1632 .\"O used to highlight various parts of the output.
1633 .\"O Its value is a colon-separated list of capabilities
1634 .\"O that defaults to
1635 .\"O .B ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36
1640 .\"O boolean capabilities omitted (i.e., false).
1641 .\"O Supported capabilities are as follows.
1642 この変数は、出力のさまざまな部分を強調するために使用する、
1644 この変数の値はコロンで区切った機能のリストであり、
1646 .B ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36
1651 という真偽値を取る機能は設定してありません (すなわち、false になっています)。
1656 .\"O SGR substring for whole selected lines
1658 .\"O matching lines when the
1660 .\"O command-line option is omitted,
1661 .\"O or non-matching lines when
1664 .\"O If however the boolean
1669 .\"O command-line option are both specified,
1670 .\"O it applies to context matching lines instead.
1671 .\"O The default is empty (i.e., the terminal's default color pair).
1672 選択される行全体に適用される SGR パラメータ
1675 オプションを指定しなかったときは、マッチする行、
1677 オプションを指定したときは、マッチしない行のことです)。
1682 の両方を指定したときは、前後の文脈行扱いになるマッチする行に
1684 デフォルトは空です (すなわち、端末のデフォルトの背景色と
1688 .\"O SGR substring for whole context lines
1690 .\"O non-matching lines when the
1692 .\"O command-line option is omitted,
1693 .\"O or matching lines when
1696 .\"O If however the boolean
1701 .\"O command-line option are both specified,
1702 .\"O it applies to selected non-matching lines instead.
1703 .\"O The default is empty (i.e., the terminal's default color pair).
1704 前後の文脈行全体に適用される SGR パラメータ
1707 オプションを指定しなかったときは、マッチしない行、
1709 オプションを指定したときは、マッチする行のことです)。
1714 の両方を指定したときは、選択されるマッチしない行に
1716 デフォルトは空です (すなわち、端末のデフォルトの背景色と
1720 .\"O Boolean value that reverses (swaps) the meanings of
1728 .\"O command-line option is specified.
1729 .\"O The default is false (i.e., the capability is omitted).
1736 機能の意味を逆にする (入れ替える) 真偽値。
1737 デフォルトは空です (すなわち、この機能は指定されていません)。
1740 .\"O SGR substring for matching non-empty text in any matching line
1742 .\"O a selected line when the
1744 .\"O command-line option is omitted,
1745 .\"O or a context line when
1748 .\"O Setting this is equivalent to setting both
1752 .\"O at once to the same value.
1753 .\"O The default is a bold red text foreground over the current line background.
1754 マッチする行ならどこでも、空文字列ではないマッチするテキストに適用される
1758 オプションを指定しなかったときは、選択される行になり、
1760 を指定したときは、前後の文脈行になります)。
1765 を同時に同じ値に設定するのと同じことです。
1766 デフォルトは、カレント行の背景色に赤い前景色の太字になっています。
1769 .\"O SGR substring for matching non-empty text in a selected line.
1770 .\"O (This is only used when the
1772 .\"O command-line option is omitted.)
1773 .\"O The effect of the
1779 .\"O capability remains active when this kicks in.
1780 .\"O The default is a bold red text foreground over the current line background.
1781 選択される行中の空文字列ではないマッチするテキストに適用される SGR パラメータ
1782 (この機能が使用されるのは、コマンドラインで
1790 機能) の効果は、この機能を使用しても、相変わらず有効です。
1791 デフォルトは、カレント行の背景色に赤い前景色の太字になっています。
1794 .\"O SGR substring for matching non-empty text in a context line.
1795 .\"O (This is only used when the
1797 .\"O command-line option is specified.)
1798 .\"O The effect of the
1804 .\"O capability remains active when this kicks in.
1805 .\"O The default is a bold red text foreground over the current line background.
1806 前後の文脈行中の空文字列ではないマッチするテキストに適用される SGR パラメータ
1807 (この機能が使用されるのは、コマンドラインで
1809 オプションが指定されているときだけです)。
1815 機能) の効果は、この機能を使用しても、相変わらず有効です。
1816 デフォルトは、カレント行の背景色に赤い前景色の太字になっています。
1819 .\"O SGR substring for file names prefixing any content line.
1820 .\"O The default is a magenta text foreground over the terminal's default background.
1821 表示される行の前にファイル名が付くとき、それに適用される SGR パラメータ。
1822 デフォルトは、端末のデフォルトの背景色にマゼンタの前景色の文字です。
1825 .\"O SGR substring for line numbers prefixing any content line.
1826 .\"O The default is a green text foreground over the terminal's default background.
1827 表示される行の前に行番号が付くとき、それに適用される SGR パラメータ。
1828 デフォルトは、端末のデフォルトの背景色に緑の前景色の文字です。
1831 .\"O SGR substring for byte offsets prefixing any content line.
1832 .\"O The default is a green text foreground over the terminal's default background.
1833 表示される行の前にバイトオフセットが付くとき、それに適用される SGR パラメータ。
1834 デフォルトは、端末のデフォルトの背景色に緑の前景色の文字です。
1837 .\"O SGR substring for separators that are inserted
1838 .\"O between selected line fields
1840 .\"O between context line fields,
1842 .\"O and between groups of adjacent lines when nonzero context is specified
1843 .\"O .RB ( \-\^\- ).
1844 .\"O The default is a cyan text foreground over the terminal's default background.
1845 区切り記号に適用される SGR パラメータ。
1846 区切り記号としては、選択される行のフィールド間には
1852 前後の文脈行の表示が指定されているときは、隣接行グループの間に
1855 デフォルトは、端末のデフォルトの背景色にシアンの前景色の記号です。
1858 .\"O Boolean value that prevents clearing to the end of line
1859 .\"O using Erase in Line (EL) to Right
1860 .\"O .RB ( \\\\\\33[K )
1861 .\"O each time a colorized item ends.
1862 .\"O This is needed on terminals on which EL is not supported.
1863 .\"O It is otherwise useful on terminals
1865 .\"O .B back_color_erase
1867 .\"O boolean terminfo capability does not apply,
1868 .\"O when the chosen highlight colors do not affect the background,
1869 .\"O or when EL is too slow or causes too much flicker.
1870 .\"O The default is false (i.e., the capability is omitted).
1872 真偽値です。通常、色付けされた項目が終わるたびに、
1873 エスケープ・シーケンス Erase in Line (EL) to Right
1878 これは、端末が EL をサポートしていない場合に必要です。
1883 を使用していない端末で、採用した強調色が背景に作用しない場合や、
1884 EL が遅すぎたり、画面にひどいチラつきを引き起こしたりする場合にも、
1886 デフォルトは false です (すなわち、この機能は設定されていません)。
1888 .\"O Note that boolean capabilities have no
1891 .\"O They are omitted (i.e., false) by default and become true when specified.
1895 の部分がないことに注意してください。そうした機能はデフォルトでは
1896 設定されていず (すなわち、false)、設定されたとき true になります。
1898 .\"O See the Select Graphic Rendition (SGR) section
1899 .\"O in the documentation of the text terminal that is used
1900 .\"O for permitted values and their meaning as character attributes.
1901 .\"O These substring values are integers in decimal representation
1902 .\"O and can be concatenated with semicolons.
1903 使用しているテキスト端末の文書にある Select Graphic Rendition (SGR) の
1904 セクションを見て、使用できる値や、それが文字属性として使われたときの意味を
1906 SGR パラメータの値は十進法の整数であり、セミコロンで結合することができます。
1908 .\"O takes care of assembling the result
1909 .\"O into a complete SGR sequence
1910 .\"O .RB ( \\\\\\33[ ... m ).
1912 はそうしたセミコロンで結合された数字から完全な SGR シーケンス
1913 .RB ( \\\\\\33[ ... m )
1915 .\"O Common values to concatenate include
1916 結合される値でよく使われるものを挙げると、
1934 .\"O for default foreground color,
1940 .\"O for foreground colors,
1948 .\"O for 16-color mode foreground colors,
1956 .\"O for 88-color and 256-color modes foreground colors,
1960 は 88 色と 256 色モードの前景色に使われます。また、
1962 .\"O for default background color,
1968 .\"O for background colors,
1976 .\"O for 16-color mode background colors, and
1984 .\"O for 88-color and 256-color modes background colors.
1988 は 88 色と 256 色モードの背景色です。
1991 \fBLC_ALL\fP, \fBLC_COLLATE\fP, \fBLANG\fP
1992 .\"O These variables specify the locale for the
1995 .\"O which determines the collating sequence
1996 .\"O used to interpret range expressions like
2004 のような範囲式を解釈するときの照合順序を決めるものです。
2006 \fBLC_ALL\fP, \fBLC_CTYPE\fP, \fBLANG\fP
2007 .\"O These variables specify the locale for the
2010 .\"O which determines the type of characters,
2011 .\"O e.g., which characters are whitespace.
2016 は文字のタイプ、たとえば、空白 (whitespace) に当たるのは
2017 どの文字とどの文字か、といったことを決めるものです。
2018 .\"O This category also determines the character encoding, that is, whether
2019 .\"O text is encoded in UTF-8, ASCII, or some other encoding. In the C or
2020 .\"O POSIX locale, all characters are encoded as a single byte and every
2021 .\"O byte is a valid character.
2022 このカテゴリーは、文字のエンコーディングも決定します。
2023 つまり、テキストのエンコーディングが UTF-8 か、ASCII か、
2024 それ以外のエンコーディングかということです。
2025 ロケールが C か POSIX の場合は、
2026 すべての文字が 1 バイトとしてエンコードされ、
2029 \fBLC_ALL\fP, \fBLC_MESSAGES\fP, \fBLANG\fP
2030 .\"O These variables specify the locale for the
2033 .\"O which determines the language that
2035 .\"O uses for messages.
2036 .\"O The default C locale uses American English messages.
2043 がメッセージに使う言語を決めるものです。
2044 デフォルトの C ロケールでは、アメリカ英語のメッセージが使用されます。
2049 .\"O behaves as \s-1POSIX\s0 requires; otherwise,
2051 .\"O behaves more like other \s-1GNU\s0 programs.
2052 .\"O \s-1POSIX\s0 requires that options that follow file names must be
2053 .\"O treated as file names; by default, such options are permuted to the
2054 .\"O front of the operand list and are treated as options.
2055 .\"O Also, \s-1POSIX\s0 requires that unrecognized options be diagnosed as
2056 .\"O \*(lqillegal\*(rq, but since they are not really against the law the default
2057 .\"O is to diagnose them as \*(lqinvalid\*(rq.
2058 .\"O .B POSIXLY_CORRECT
2059 .\"O also disables \fB_\fP\fIN\fP\fB_GNU_nonoption_argv_flags_\fP,
2060 .\"O described below.
2063 は \s-1POSIX\s0 が要求するとおりの動作をします。
2064 設定されていない場合の動作は、ほかの \s-1GNU\s0 のプログラムに
2066 \s-1POSIX\s0 の規定では、ファイル名の後にオプションが現れた場合、
2067 それをファイル名として扱わなければならないことになっています。
2070 のデフォルトでは、そうしたオプションを引き数リストの前の方に移動して、
2072 また、\s-1POSIX\s0 の規定では、理解できないオプションは
2073 \*(lqillegal\*(rq (違法) と判断するようになっていますが、
2074 そうしたオプションも法律に違反しているわけではないので、
2076 のデフォルトでは、\*(lqinvalid\*(rq (無効) という判断を下します。
2078 .\" .B POSIXLY_CORRECT
2079 .\" は、下記の \fB_\fP\fIN\fP\fB_GNU_nonoption_argv_flags_\fP を無効にします。
2080 .\" (訳注: 次項を表示しないことに合わせて、「さらに」以下の文も
2083 .\" \fB_\fP\fIN\fP\fB_GNU_nonoption_argv_flags_\fP
2088 .\"O numeric process ID.) If the
2090 .\"O character of this environment variable's value is
2092 .\"O do not consider the
2096 .\"O to be an option, even if it appears to be one.
2097 .\"O A shell can put this variable in the environment for each command it runs,
2098 .\"O specifying which operands are the results of file name wildcard
2099 .\"O expansion and therefore should not be treated as options.
2100 .\"O This behavior is available only with the \s-1GNU\s0 C library, and only
2102 .\"O .B POSIXLY_CORRECT
2109 .\" のプロセス ID 番号です) もし、この環境変数の値の
2117 .\" 番目の引き数がオプションのように見えても、
2118 .\" それをオプションと見なしてはいけない、ということです。
2119 .\" シェルはコマンドを実行するたびに、そのコマンドの環境にこの変数を
2120 .\" 挿入して、どの引き数がファイル名をワイルドカード展開した結果であり、
2121 .\" それ故オプションとして扱ってはいけないかを指定することができます。
2122 .\" この動作は \s-1GNU\s0 C ライブラリを使用しているときにのみ、それも、
2123 .\" .B POSIXLY_CORRECT
2124 .\" が設定されていないときにのみ、利用することができます。
2125 .\" (訳注: この環境変数は、bash 2.0 で採用されたが、問題を起こすために
2126 .\" bash 2.01 で削除されたとのことです。それ故、ユーザからは man
2127 .\" コマンドで見えないようにしておきます。getopt(3) を参照してください)
2129 .\"O .SH "EXIT STATUS"
2131 .\"O Normally the exit status is 0 if a line is selected, 1 if no lines
2132 .\"O were selected, and 2 if an error occurred. However, if the
2137 .\"O .B \-\^\-silent
2138 .\"O is used and a line is selected, the exit status is 0 even if an error
2141 通常では、選択される行が見つかったときの終了ステータスは 0 であり、
2142 見つからなかったときは 1 であり、エラーが起きた場合は 2 です。
2147 といったオプションが使われていて、選択される行が見つかったときは、
2148 エラーが起きたときでも終了ステータスは 0 です。
2152 Copyright 1998-2000, 2002, 2005-2016 Free Software Foundation, Inc.
2154 This is free software;
2155 see the source for copying conditions.
2156 There is NO warranty;
2157 not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2161 .\"O .SS "Reporting Bugs"
2163 .\"O Email bug reports to
2164 .\"O .MTO bug-grep@gnu.org "the bug-reporting address" .
2166 .\"O .URL http://lists.gnu.org/mailman/listinfo/bug-grep "email archive"
2168 .\"O .URL http://debbugs.gnu.org/cgi/pkgreport.cgi?package=grep "bug tracker"
2171 .MTO bug-grep@gnu.org "バグ報告アドレス"
2173 .URL http://lists.gnu.org/mailman/listinfo/bug-grep "メールアーカイブ"
2175 .URL http://debbugs.gnu.org/cgi/pkgreport.cgi?package=grep "バグトラッカー"
2177 .\"O .SS "Known Bugs"
2179 .\"O Large repetition counts in the
2181 .\"O construct may cause
2183 .\"O to use lots of memory.
2185 .\"O certain other obscure regular expressions require exponential time
2186 .\"O and space, and may cause
2188 .\"O to run out of memory.
2193 は大量のメモリを消費するかもしれません。
2194 また、ほかの曖昧な正規表現にも、指数関数的な時間と
2199 .\"O Back-references are very slow, and may require exponential time.
2201 後方参照は非常に遅く、とんでもなく時間がかかることがあります。
2205 .\"O .SS "Regular Manual Pages"
2207 awk(1), cmp(1), diff(1), find(1), gzip(1),
2208 perl(1), sed(1), sort(1), xargs(1), zgrep(1),
2210 pcre(3), pcresyntax(3), pcrepattern(3),
2213 .\"O .SS "\s-1POSIX\s0 Programmer's Manual Page"
2214 .SS "\s-1POSIX\s0 プログラマーズ・マニュアルページ"
2216 .\"O .SS "Full Documentation"
2219 .\"O .URL http://www.gnu.org/software/grep/manual/ "complete manual"
2225 .\"O programs are properly installed at your site, the command
2229 .\"O should give you access to the complete manual.
2231 .URL http://www.gnu.org/software/grep/manual/ "完全版のマニュアル"
2236 プログラムが御使用のサイトにきちんとインストールされているならば、
2240 とコマンドを打ち込むことで、完備したマニュアルが読めるはずです。
2243 .\"O This man page is maintained only fitfully;
2244 .\"O the full documentation is often more up-to-date.
2246 このマニュアルは断続的にメンテナンスされるため、
2247 完全版の文書のほうが最新であることがよくあります。
2249 この翻訳は、FreeBSD jpman Project <http://www.jp.freebsd.org/man-jp/>
2250 から Linux JM project に寄贈していただいたマニュアルを元にし、
2251 GNU grep の新しいマニュアルに合わせて、増補・改訂しています。
2252 この場を借りて、FreeBSD jpman Project の翻訳者の方々にお礼を申し上げます。
2253 .\" Work around problems with some troff -man implementations.