Chinaunix首页 | 论坛 | 博客
  • 博客访问: 366954
  • 博文数量: 83
  • 博客积分: 5322
  • 博客等级: 中校
  • 技术积分: 1057
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-11 11:27
个人简介

爱生活,爱阅读

文章分类

全部博文(83)

文章存档

2015年(1)

2013年(1)

2012年(80)

2011年(1)

分类: LINUX

2012-08-25 17:42:10

     linux下通过man查看命令(原型)很常见,自己对英文文档理解起来总是费力。这两天试图对照文档翻译一下,发现水平的确差。但终归要先找到缺陷才能修复,也不怕拍砖了,把对文档的翻译(+理解)贴出来(有时候感觉意思清楚了,但是用文字表达起来总是很费劲,差距啊差距)。后续逐步更正吧。
    [admin@localhost parttwo]$ man grep
GREP(1)                                                                GREP(1)

NAME
名称
       grep, egrep, fgrep - print lines matching a pattern
       列出匹配模式的行

SYNOPSIS
摘要
       grep [options] PATTERN [FILE...]
       grep [options] [-e PATTERN | -f FILE] [FILE...]

DESCRIPTION
描述
       Grep  searches  the  named input FILEs (or standard input if no files are named, or the file name - is given) for
       lines containing a match to the given PATTERN.  By default, grep prints the matching lines.
       grep 搜索输入的文件名为FILES的文件,(如果没有指明文件名,则默认为标准输入。或者指明文件名为-),搜索匹配模式PATTERN的行。
       默认情况下,grep列出匹配的行。

       In addition, two variant programs egrep and fgrep are available.  Egrep is the same as  grep -E.   Fgrep  is  the
       same as grep -F.
       另外,两个变体egrep,fgrep可用。Egrep与grep -e相同Fgrep 与grep -f相同。

OPTIONS
       -A NUM, --after-context=NUM
              Print  NUM lines of trailing context after matching lines.  Places a line containing -- between contiguous
              groups of matches.
              列出匹配的行之后的NUM行。在相邻匹配的组之间打印包括--字符的行。

       -a, --text
              Process a binary file as if it were text; this is equivalent to the --binary-files=text option.
              将二进制文件作为文本文件处理;这与--binary-fles=text选项等价。

       -B NUM, --before-context=NUM
              Print NUM lines of leading context before matching lines.  Places a line containing -- between  contiguous
              groups of matches.
              列出匹配的行之前NUM行。在相邻匹配的组之间打印包括--字符的行。

       -C NUM, --context=NUM
              Print NUM lines of output context.  Places a line containing -- between contiguous groups of matches.
              列出匹配的行前后上下文各NUM行。在相邻匹配的组之间打印包括--字符的行。

       -b, --byte-offset
              Print the byte offset within the input file before each line of output.
              在每个匹配行之前列出匹配行在输入文件的字节偏移量。

       --binary-files=TYPE
              If  the  first few bytes of a file indicate that the file contains binary data, assume that the file is of
              type TYPE.  By default, TYPE is binary, and grep normally outputs either a one-line message saying that  a
              binary  file  matches,  or no message if there is no match.  If TYPE is without-match, grep assumes that a
              binary file does not match; this is equivalent to the -I option.  If TYPE is text, grep processes a binary
              file  as  if  it  were text; this is equivalent to the -a option.  Warning: grep --binary-files=text might
              output binary garbage, which can have nasty side effects if the output is a terminal and if  the  terminal
              driver interprets some of it as commands.
              如果文件的前几个字节指示当前文件包含二进制数据,则假定文件是TYPE类型文件。默认的,TYPE是二进制,且grep通常
              输出一条信息声明这是一个二进制文件,或者是如果没有匹配则无信息输出。如果TYPE没有匹配,grep假定二进制文件没
              有匹配;这与-I选项等效。如果TYPE是文本类型,则grep将二进制文件作为text文件处理。这与-a选项等效。警告:grep --
              binary-files=text会输出二进制垃圾数据,当这些垃圾数据中包含结束符或者一些内容作为命令解析,则具有副作用。

       --colour[=WHEN], --color[=WHEN]
              Surround the matching string with the marker find in GREP_COLOR environment variable. WHEN may be ‘never’,
              ‘always’, or ‘auto’
              匹配的字符串将周围会按照GREP_COLOR环境变量中的设置进行标记。WHEN 可以取never always 或者auto

       -c, --count
              Suppress normal output; instead print a count of matching  lines  for  each  input  file.   With  the  -v,
              --invert-match option (see below), count non-matching lines.
              抑制正常的输出,取而代之的是对于每一个输入文件输出匹配的行数。连上-v,--invert-match 选项,则输出不匹配行数。
              
       -D ACTION, --devices=ACTION
              If an input file is a device, FIFO or socket, use ACTION to process it.  By default, ACTION is read, which
              means that devices are read just as if they were ordinary files.  If ACTION is skip, devices are  silently
              skipped.
              如果输入文件时一个设备,FIFO或者套接字,则采用ACTION处理之。默认情况下,ACTION 是读,也就是说,将该设备当做
              普通文件进行读操作。如果跳过了ACTION,则跳过该设备。 

       -d ACTION, --directories=ACTION
              If  an  input file is a directory, use ACTION to process it.  By default, ACTION is read, which means that
              directories are read just as if they were ordinary files.  If ACTION is  skip,  directories  are  silently
              skipped.  If ACTION is recurse, grep reads all files under each directory, recursively; this is equivalent
              to the -r option.
              如果输入文件是一个目录,则使用ACTION处理之。默认情况下,ACTION是读,也就是将目录当做普通文件进行读操作。如果
              忽略ACTION,则跳过目录。如果ACTION是递归的,则grep递归地读取目录下的所有文件,这与-r选项等效。

       -E, --extended-regexp
              Interpret PATTERN as an extended regular expression (see below).
              将PATTERN作为扩展的正则表达式解析(参见下面)。

       -e PATTERN, --regexp=PATTERN
              Use PATTERN as the pattern; useful to protect patterns beginning with -.
              将PATTERN作为模式;对于保护以‘-’开头的模式是有用的

       -F, --fixed-strings
              Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched.
              将PATTERN作为一列固定的以换行为分割符的,待匹配的字符串,

       -P, --perl-regexp
              Interpret PATTERN as a Perl regular expression.
              将PATTERN作为PERL正则表达式进行解析。

       -f FILE, --file=FILE
              Obtain patterns from FILE, one per line.  The empty file contains zero  patterns,  and  therefore  matches
              nothing.
              从文件FILE 中获取模式,每行一个。空文件包括零模式,所以不会匹配任何内容。

       -G, --basic-regexp
              Interpret PATTERN as a basic regular expression (see below).  This is the default.
              将PATTERN作为基本的正则表达式解析。这是默认的。

       -H, --with-filename
              Print the filename for each match.
              列出每一个匹配的文件名。

       -h, --no-filename
              Suppress the prefixing of filenames on output when multiple files are searched.
              在搜索多个文件时候,一直文件名的前缀。

       --help Output a brief help message.
               列出一个简短的帮助信息。

       -I     Process  a  binary  file  as  if  it  did  not  contain matching data; this is equivalent to the --binary-
              files=without-match option.
              将二进制文件当做不匹配任何模式的数据;这与--binary-files=without-match 选项等效。

       -i, --ignore-case
              Ignore case distinctions in both the PATTERN and the input files.
              忽略模式与输入文件的字母大小写。

       -L, --files-without-match
              Suppress normal output; instead print the name of each input file from which no output would normally have
              been printed.  The scanning will stop on the first match.
              抑制正常的输出;不列出输入的文件名,也不会列出任何正常的输出。扫描将在第一个匹配处停止。

       -l, --files-with-matches
              Suppress  normal  output;  instead print the name of each input file from which output would normally have
              been printed.  The scanning will stop on the first match.
              抑制正常的输出;仅仅列出输入的文件名。扫描将在第一个匹配处停止。

       -m NUM, --max-count=NUM
              Stop reading a file after NUM matching lines.  If the input is standard input from a regular file, and NUM
              matching  lines  are  output,  grep  ensures  that the standard input is positioned to just after the last
              matching line before exiting, regardless of the presence of trailing context lines.  This enables a  call-
              ing process to resume a search.  When grep stops after NUM matching lines, it outputs any trailing context
              lines.  When the -c or --count option is also used, grep does not output a count greater than  NUM.   When
              the -v or --invert-match option is also used, grep stops after outputting NUM non-matching lines.
              在一个文件的NUM行之后就停止读入文件。如果输入是一个从普通文件获取的标准输入,已经列出NUM行匹配行,grep保证
              标准输入停留在最后匹配行之后的未知,而忽略尾部上相行。这使得一个信的进程重新开始一个搜索。当grep在NUM匹配行
              之后停止,它将输出尾部上下文行。当-c 或者--count选项页使用时,grepgrep不会输出大于NUM行。当-v或者--invert-match
              选项使用时,grep在输出NUM行非匹配行之后停止。

       --mmap If  possible,  use  the mmap(2) system call to read input, instead of the default read(2) system call.  In
              some situations, --mmap yields better performance.  However, --mmap can cause undefined behavior  (includ-
              ing core dumps) if an input file shrinks while grep is operating, or if an I/O error occurs.
              如果可能,使用系统调用取读取输入,而不是默认的read系统调用。在一些情景之下,--mmap产生更好的性能。然而,--mmap
              也会导致不确定的行为(包括内核重启),当grep正在操作时候,输入文件变化或者I/O错误发生。

       -n, --line-number
              Prefix each line of output with the line number within its input file.
              在每个输出的匹配行之前列出该行在输入文件中的行号。

       -o, --only-matching
              Show only the part of a matching line that matches PATTERN.
              仅仅列出匹配模式PATTERN的部分。
              ------也就是说,仅仅列出与模式PATTERN相匹配的部分,其他部分不列出。

       --label=LABEL
              Displays  input  actually  coming from standard input as input coming from file LABEL.  This is especially
              useful for tools like zgrep, e.g.  gzip -cd foo.gz |grep --label=foo something
              来自标准输入

       --line-buffered
              Use line buffering, it can be a performance penality.
              采用行缓冲,这将影响性能。。。。。。

       -q, --quiet, --silent
              Quiet; do not write anything to standard output.  Exit immediately with zero status if any match is found,
              even if an error was detected.  Also see the -s or --no-messages option.
              沉默,不向标准输出输出任何东西。如果发生错误或者匹配陈宫,立即退出。如果匹配成功,且则退出码为0。参见-s --no
              --message选项。

       -R, -r, --recursive
              Read all files under each directory, recursively; this is equivalent to the -d recurse option.
              递归地读取每一个目录下的文件;这与-d递归选项等效。

         --include=PATTERN
              Recurse in directories only searching file matching PATTERN.
              在目录中仅仅搜索匹配模式PATTERN的文件。

         --exclude=PATTERN
              Recurse in directories skip file matching PATTERN.
              在目录中递归的跳过匹配模式PATTERN的文件。

       -s, --no-messages
              Suppress  error messages about nonexistent or unreadable files.  Portability note: unlike GNU grep, tradi-
              tional grep did not conform to POSIX.2, because traditional grep lacked a -q  option  and  its  -s  option
              behaved like GNU grep’s -q option.  Shell scripts intended to be portable to traditional grep should avoid
              both -q and -s and should redirect output to /dev/null instead.
              抑制关于不存在或者不可读的错误信息。

       -U, --binary
              Treat the file(s) as binary.  By default, under MS-DOS and MS-Windows, grep guesses the file type by look-
              ing  at  the  contents  of the first 32KB read from the file.  If grep decides the file is a text file, it
              strips the CR characters from the original file contents (to make regular expressions with ^  and  $  work
              correctly).  Specifying -U overrules this guesswork, causing all files to be read and passed to the match-
              ing mechanism verbatim; if the file is a text file with CR/LF pairs at the end of  each  line,  this  will
              cause  some regular expressions to fail.  This option has no effect on platforms other than MS-DOS and MS-
              Windows.
              将一个文件视作二进制的。默认情况下,在MS-DOS 与MS-WINDOWS环境下,grep通常是通过文件的前32K内容判断文件的类型
              。如果grep认定文件是文本文件,它将原始文件中的CR字符剥离(使得"^","$"能正确工作)。指定-U选项将推翻此类猜测,
              而是读取所有文件内容并逐字匹配;如果文件是文本文件并且每行以CR/LF成对结尾,这将导致一些正则表达式失败。该选项
              除了在MS-DOS与MS-WINDOWS下之外无效。

       -u, --unix-byte-offsets
              Report Unix-style byte offsets.  This switch causes grep to report byte offsets as if the file were  Unix-
              style  text  file,  i.e.  with CR characters stripped off.  This will produce results identical to running
              grep on a Unix machine.  This option has no effect unless -b option is also used;  it  has  no  effect  on
              platforms other than MS-DOS and MS-Windows.
              报告UNIX类型的字节偏移。该开关将使得grep假定文件是unix风格的文本文件输出字节偏移。例如,将CR除掉。这将使得grep
              与unix下运行结果一样。该选项无效除非-b选项使能。除了MS-DOS 与 MS-WINDOWS外该选项无效。

       -V, --version
              Print  the  version  number  of grep to standard error.  This version number should be included in all bug
              reports (see below).
              向标准错误输出grep版本号。这个版本号应该包括所有的缺陷修改报告。

       -v, --invert-match
              Invert the sense of matching, to select non-matching lines.
              不列出匹配行,而是列出不匹配的行。

       -w, --word-regexp
              Select only those lines containing matches that form whole words.  The test is that the matching substring
              must  either be at the beginning of the line, or preceded by a non-word constituent character.  Similarly,
              it must be either at the end of the line or followed  by  a  non-word  constituent  character.   Word-con-
              stituent characters are letters, digits, and the underscore.
              仅仅列出哪些包含整个单词的行。该测试匹配那些行开头的字串,或者一个非字母字符。简单而言,他应该要么是一行
              的结尾,要么在一个非字母字符。字母字符包括,字母数字以及下划线。

       -x, --line-regexp
              Select only those matches that exactly match the whole line.
              仅仅列出那些精确匹配一行的行。

       -y     Obsolete synonym for -i.
              废弃的,同-i

       -Z, --null
              Output  a  zero byte (the ASCII NUL character) instead of the character that normally follows a file name.
              For example, grep -lZ outputs a zero byte after each file name instead of the usual newline.  This  option
              makes  the  output unambiguous, even in the presence of file names containing unusual characters like new-
              lines.  This option can be used with commands like find -print0, perl -0, sort -z, and xargs -0 to process
              arbitrary file names, even those that contain newline characters.
              输出一个NULL而不是通常一个文件名之后的换行符。

REGULAR EXPRESSIONS
正则表达式
       A  regular  expression  is a pattern that describes a set of strings.  Regular expressions are constructed analo-
       gously to arithmetic expressions, by using various operators to combine smaller expressions.
       正则表达式是一个描述字符串集的模式。正则表达式与算数表达式的构成相似,通过不同的操作符将较小的表达式组合起来。

       Grep understands two different versions of regular expression syntax: “basic” and “extended.”  In GNU grep, there
       is no difference in available functionality using either syntax.  In other implementations, basic regular expres-
       sions are less powerful.  The following description applies to  extended  regular  expressions;  differences  for
       basic regular expressions are summarized afterwards.
       Grep能解析两中不同版本的正则表达式语法:“基本正则表达式” 与 “扩展正则表达式”。在GNU版本grep,每个版本中的可用功能
       没有语法差别。在其他实现中,基本正则表达式功能较少。下面的描述适用于扩展正则表达式。与基本正则表达式不同的地方在
       稍后总结出来。

       The  fundamental  building  blocks  are  the regular expressions that match a single character.  Most characters,
       including all letters and digits, are regular expressions that match themselves.  Any metacharacter with  special
       meaning may be quoted by preceding it with a backslash.
       最基本的组成块是匹配一个单字符的正则表达式。对于大多数字符包括所有的字母、数字而言,正则表达式匹配其本身。任何具备
       特殊意义的元字符将通过前缀的反斜杠引用。

       A  bracket expression is a list of characters enclosed by [ and ].  It matches any single character in that list;
       if the first character of the list is the caret ^ then it matches any character not in the  list.   For  example,
       the regular expression [0123456789] matches any single digit.
       括号表达式是由中括号[]括起来的一系列字符。它匹配任意单个的位于给列表的字符;如果列表的第一个字符为^,那么它将匹配
       任何一个不再该列表的字符。例如正则表达式[0123456789]匹配任何一个但数字。

       Within a bracket expression, a range expression consists of two characters separated by a hyphen.  It matches any
       single character that sorts between the two characters, inclusive, using  the  locale’s  collating  sequence  and
       character  set.   For example, in the default C locale, [a-d] is equivalent to [abcd].  Many locales sort charac-
       ters in dictionary order, and in these locales [a-d] is typically not equivalent to [abcd]; it might  be  equiva-
       lent to [aBbCcDd], for example.  To obtain the traditional interpretation of bracket expressions, you can use the
       C locale by setting the LC_ALL environment variable to the value C.
       在括号表达式内部,一个范围表达式包括用“-”号分开的字符。它匹配任何一个在两个字符及之间的字符,包括采用。。的字符集。
       例如默认的C类型,[a-d]与[abcd]等效。一些本地话按照字典的顺序将字符排序,在该类中[a-d]与[abcd]不等效。它可能与[aAbBcCdD]
       等效。为了获得通常意义的括号表达式的解析方式,你应该通过设定LC_ALL环境变量为C而是用C类型的本地化。。。。。。

       Finally, certain named classes of characters are predefined within bracket expressions, as follows.  Their  names
       are  self  explanatory, and they are [:alnum:], [:alpha:], [:cntrl:], [:digit:], [:graph:], [:lower:], [:print:],
       [:punct:], [:space:], [:upper:], and [:xdigit:].  For example, [[:alnum:]] means [0-9A-Za-z], except  the  latter
       form  depends upon the C locale and the ASCII character encoding, whereas the former is independent of locale and
       character set.  (Note that the brackets in these class names are part of the symbolic names, and must be included
       in  addition to the brackets delimiting the bracket list.)  Most metacharacters lose their special meaning inside
       lists.  To include a literal ] place it first in the list.  Similarly, to include a literal ^ place  it  anywhere
       but first.  Finally, to include a literal - place it last.
       最后,一些命名的括号表达式已经事先定义好,如下所示。它们的名字就代表它们的意义:。。例如:[[:alnum:]]代表[0-9a-zA-Z]
       除非后则取决于C类型以及ASCII字符集,而前者是独立于字符集与C类型的。(注意,括号是这些命名的表达式的一部分,并且必须
       作为界定符存在)。大多数在括号内的元字符失去了特殊意义。为了包含一个“]”,将其放在方括号的列表首位。相似的,为了包含一个“^”
       将其放在首位。最后,为了包含“-”,将其放在最后。

       The  period  .  matches any single character.  The symbol \w is a synonym for [[:alnum:]] and \W is a synonym for
       [^[:alnum]].
       句号匹配所有的单个字符。“\w”与[[:alnum:]]同义,而"\W"与[^[:alnum]]同义。

       The caret ^ and the dollar sign $ are metacharacters that respectively match the empty string  at  the  beginning
       and end of a line.  The symbols \< and \> respectively match the empty string at the beginning and end of a word.
       The symbol \b matches the empty string at the edge of a word, and \B matches the empty string provided  it’s  not
         at the edge of a word.
       "^"与“$”是元字符,分别匹配一行的开头与结尾。"\<","\>"匹配一个完整的单词。符号"\b"匹配任何一个空字符的边界,"\B"匹配
       任何一个不在边界的空字符。
       
       A regular expression may be followed by one of several repetition operators:
       正则表达式通常用下面几种方式表示重复操作:
       ?      The preceding item is optional and matched at most once.
       匹配前面的字符0次或者最多1次。
       *      The preceding item will be matched zero or more times.
       匹配前面的字符0次或者多次。
       +      The preceding item will be matched one or more times.
       匹配前面你的字符至少1次。
       {n}    The preceding item is matched exactly n times.
       匹配前面的字符n次。
       {n,}   The preceding item is matched n or more times.
       匹配前面的字符至少n次。
       {n,m}  The preceding item is matched at least n times, but not more than m times.
       匹配前面的字符至少n次,但最多不超过m次。

       Two  regular  expressions may be concatenated; the resulting regular expression matches any string formed by con-
       catenating two substrings that respectively match the concatenated subexpressions.
       两个正则表达式能够联合起来;联合后的正则表达式匹配任何的一个分别匹配子正则表达式。

       Two regular expressions may be joined by the infix operator |;  the  resulting  regular  expression  matches  any
       string matching either subexpression.
       两个正则表达式可以通过"|"联合起来;结果正则表达式匹配任何子正则表达式。

       Repetition  takes precedence over concatenation, which in turn takes precedence over alternation.  A whole subex-
       pression may be enclosed in parentheses to override these precedence rules.
       ???????????????????????????????????????????????????????????????????????????????????????????????
       重复操作符的优先级比连接搞,接下来又比选择的优先级高。一个完整的子表达式可以用圆括号括起来来重新设置这些优先级别。

       The backreference \n, where n is a single digit, matches the substring previously matched by  the  nth  parenthe-
       sized subexpression of the regular expression.
       后置引用"\n",你是一个单独的数字,匹配。。。。。

       In  basic regular expressions the metacharacters ?, +, {, |, (, and ) lose their special meaning; instead use the
       backslashed versions \?, \+, \{, \|, \(, and \).
       在基本的正则表达式中,元字符?+{|()失去特殊意义。取而代之的是使用反斜杠引用的形式。
       ----------普通模式下,及基本正则表达式模式下,{}这些符号是没有特殊意义的,但是如果采用了反斜杠引用的形式,则具备了
       对应的特殊意义。

       Traditional egrep did not support the { metacharacter, and some egrep  implementations  support  \{  instead,  so
       portable scripts should avoid { in egrep patterns and should use [{] to match a literal {.
       通常egrep不支持"{"元字符,而一些egrep实现支持"\{",所以可移植的脚本应该避免在egrep中使用"{"而应当使用"[{]"来代表字面
       意义的"{"。

       GNU  egrep attempts to support traditional usage by assuming that { is not special if it would be the start of an
       invalid interval specification.  For example, the shell command egrep ’{1’ searches for the two-character  string
       {1  instead of reporting a syntax error in the regular expression.  POSIX.2 allows this behavior as an extension,
       but portable scripts should avoid it.
       GNU版本的egrep试图支持传统的用法,它假定"{"不是特殊的,如果其是一个无效的间隔表达符。例如,shell命令egrep ‘{1’搜索
       “{1”而不是报告正则表达式的语法错误。POSIX.2允许这种行为作为一个扩展,但是可移植脚本应该避免这种情况。

ENVIRONMENT VARIABLES
环境变量
       Grep’s behavior is affected by the following environment variables.
       Grep的行为受到下面的环境变量的影响。

       A locale LC_foo is specified by examining the three environment variables LC_ALL, LC_foo, LANG,  in  that  order.
       The  first  of  these variables that is set specifies the locale.  For example, if LC_ALL is not set, but LC_MES-
       SAGES is set to pt_BR, then Brazilian Portuguese is used for the LC_MESSAGES locale.  The C  locale  is  used  if
       none  of  these environment variables are set, or if the locale catalog is not installed, or if grep was not com-
       piled with national language support (NLS).
       本地化LC_foo通过检查三个环境变量:LC_ALL,LC_foo,LANG设定。这三个变量中的第一个变量指定了本地化。例如,如果LC_ALL
       没有设定,但是LC_MESSAGES设定为pt_BR,这样巴西葡萄牙语将用于LC_MESSAGES,如果这些环境变量没有设定,则采用C本地化,或者
       本地化目录没有被安装,或者grep与国家语言支持不兼容。

       GREP_OPTIONS
              This variable specifies default options to be placed in front of any explicit options.   For  example,  if
              GREP_OPTIONS  is  ’--binary-files=without-match  --directories=skip’,  grep  behaves as if the two options
              --binary-files=without-match and --directories=skip  had  been  specified  before  any  explicit  options.
              Option  specifications  are separated by whitespace.  A backslash escapes the next character, so it can be
              used to specify an option containing whitespace or a backslash.
              这个变量指明了默认的选项,该选项用于放在任何显示选项之前。例如,如果GREP_OPTION设置那个为’--binary-files=without-match  --directories=skip’,
              grep将--binary-files=without-match and --directories=skip两个选项设定为任何显示选项的前面。选项规格之间
              通过空格分开。反斜杠钻一下一个紧接着的字符,所以它可以指明包含空格或者反斜杠的选项。

       GREP_COLOR
              Specifies the marker for highlighting.
              指明高亮的标识。
              
       LC_ALL, LC_COLLATE, LANG
              These variables specify the LC_COLLATE locale, which determines the collating sequence used  to  interpret
              range expressions like [a-z].
              这些环境变量指明本地化后的LC_COLLATE,这决定了解析像[a-z]这样的范围表达式。

       LC_ALL, LC_CTYPE, LANG
              These  variables specify the LC_CTYPE locale, which determines the type of characters, e.g., which charac-
              ters are whitespace.
              这些变量指明了本地化后的LC_cTYPE,这决定了字符类型,例如,什么样的字符时空格。

       LC_ALL, LC_MESSAGES, LANG
              These variables specify the LC_MESSAGES locale, which determines the language that grep uses for messages.
              The default C locale uses American English messages.
              这些变量指明了本地化的LC_MESSAGES,这决定了grep消息采用的语言。默认的本地化C使用美式英语。

       POSIXLY_CORRECT
              If  set,  grep behaves as POSIX.2 requires; otherwise, grep behaves more like other GNU programs.  POSIX.2
              requires that options that follow file names must be treated as file names; by default, such  options  are
              permuted  to the front of the operand list and are treated as options.  Also, POSIX.2 requires that unrec-
              ognized options be diagnosed as “illegal”, but since they are not really against the law the default is to
              diagnose  them as “invalid”.  POSIXLY_CORRECT also disables _N_GNU_nonoption_argv_flags_, described below.
              如果设定,grep按照POSIX.2要求执行;否则grep按照GNU方式的程序运行。POSIX.2需要文件名后面的该选项必须将其视作
              文件名;默认情况下,该选项。。。。。。。。。。。。。

       _N_GNU_nonoption_argv_flags_
              (Here N is grep’s numeric process ID.)  If the ith character of this environment variable’s value is 1, do
              not  consider the ith operand of grep to be an option, even if it appears to be one.  A shell can put this
              variable in the environment for each command it runs, specifying which operands are the  results  of  file
              name  wildcard  expansion and therefore should not be treated as options.  This behavior is available only
              with the GNU C library, and only when POSIXLY_CORRECT is not set.
              (这里的N是grep的数字进程ID),如果本地环境变量ith字符的之设定为1,不要讲grep的ith看做一个选项。。。。

DIAGNOSTICS
特征
       Normally, exit status is 0 if selected lines are found and 1 otherwise.  But the exit status is  2  if  an  error
       occurred, unless the -q or --quiet or --silent option is used and a selected line is found.
       通常上,如果匹配到了相应的行,返回0,否则返回1.如果发生错误将返回2,除非-q 或者--quiet 或者--silent选项使能并且找
       到了相应的行。

BUGS
缺陷
       Email bug reports to bug-grep@gnu.org.
       将缺陷报告发送至bug-grep@gnu.org。
       Large  repetition counts in the {n,m} construct may cause grep to use lots of memory.  In addition, certain other
       obscure regular expressions require exponential time and space, and may cause grep to run out of memory.
       {n,m}中重复的数值如果较大将使得grep占用大量的内存。另外,特定的灰色的正则表达式占用大量的时间与空间,可能导致Grep
       用完所有内存。

       Backreferences are very slow, and may require exponential time.
       反引用很慢,并且会需要指数级的时间。

GNU Project                       2002/01/22                           GREP(1)


阅读(1776) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~