man diff

DIFF(1)                            GNU Tools                           DIFF(1)
NAME/名称
       diff - find differences between two files/diff-查找两个文件之间的差异
SYNOPSIS/简介
       diff [options] from-file to-file/文件与文件之间的差异[选项]
DESCRIPTION/描述
       In  the simplest case, diff compares the contents of the two files from-file
       and to-file.  A file name of - stands for text read from the standard input.
       As a special case, diff - - compares a copy of standard input to itself.
    在最简单的情况下,diff比较两个文件从文件到文件的内容。
    文件名-表示从标准输入中读取的文本。作为一种特殊情况,
    diff-将标准输入的副本与自身进行比较。
       If  from-file  is  a directory and to-file is not, diff compares the file in
       from-file whose file name is that of to-file,  and  vice  versa.   The  non-
       directory file must not be -.
    如果“从文件”是目录,而“到文件”不是目录,diff将“从文件”中的文件与“到文件”中的文件进行比较,
    反之亦然。非目录文件不能为-。
       If  both  from-file and to-file are directories, diff compares corresponding
       files in both directories, in alphabetical order;  this  comparison  is  not
       recursive unless the -r or --recursive option is given.  diff never compares
       the actual contents of a directory as if it were a file.  The file  that  is
       fully  specified  may not be standard input, because standard input is name-
       less and the notion of ?.€.ile with the same name?.€.does not apply.
    如果“从文件”和“到文件”都是目录,diff将按字母顺序比较两个目录中相应的文件;
    除非给出-r或--recursive选项,否则此比较不是递归的。diff从不将目录的实际内容与文件进行比较。
    完全指定的文件可能不是标准输入,因为标准输入没有名称,而且概念是?同名的吗?.€不适用。
       diff options begin with -, so normally from-file and to-file may  not  begin
       with -.  However, -- as an argument by itself treats the remaining arguments
       as file names even if they begin with -.
    diff选项以-开头,因此通常“从文件”和“到文件”不能以-开头。
    但是,--,作为参数本身,将其余参数视为文件名,即使它们以-开头。
   Options/选项
       Below is a summary of all of  the  options  that  GNU  diff  accepts.   Most
       options  have two equivalent names, one of which is a single letter preceded
       by -, and the other of which is a long name preceded by --.  Multiple single
       letter  options (unless they take an argument) can be combined into a single
       command line word: -ac is equivalent to -a -c.  Long named  options  can  be
       abbreviated to any unique prefix of their name.  Brackets ([ and ]) indicate
       that an option takes an optional argument.
    下面是GNU diff接受的所有选项的摘要。 大多数选项都有两个等价的名称,
    其中一个是以-开头的单个字母,另一个是以--开头的长名称。
    可以将多个单字母选项(除非它们带有参数)组合为一个命令行单词:-a c等效于-a-c。
    长名称选项可以缩写为其名称的任何唯一前缀。方括号([和])表示选项接受可选参数。
       -lines Show lines (an integer) lines of context.  This option does not spec-
              ify  an  output  format by itself; it has no effect unless it is com-
              bined with -c or -u.  This option is obsolete.  For proper operation,
              patch typically needs at least two lines of context.
    -行显示上下文的行(整数)。此选项本身不指定输出格式;除非与-c或-u组合,否则它无效。
    此选项已过时。为了正确操作,补丁通常需要至少两行上下文。
       -a     Treat  all  files as text and compare them line-by-line, even if they
              do not seem to be text.
     将所有文件视为文本并逐行比较,即使它们看起来不是文本。
       -b     Ignore changes in amount of white space.
     忽略空白量的更改。
       -B     Ignore changes that just insert or delete blank lines.
     忽略只插入或删除空行的更改。
       --brief
              Report only whether the files differ, not the details of the  differ-
              ences.
     只报告文件是否不同,而不报告差异的详细信息。
       -c     Use the context output format.
     使用上下文输出格式。
       -C lines/线
       --context[=lines]
              Use  the  context  output format, showing lines (an integer) lines of
              context, or three if lines is not given.  For proper operation, patch
              typically needs at least two lines of context.
     使用上下文输出格式,显示上下文的行(整数),如果没有给出行,则使用三行。
     为了正确操作,补丁通常需要至少两行上下文。
       --changed-group-format=format
              Use  format  to  output  a line group containing differing lines from
              both files in if-then-else format.
    --changed group format=格式             
     使用format以if-then-else格式输出包含两个文件不同行的行组。
    
       -d     Change the algorithm to perhaps find a smaller set of changes.   This
              makes diff slower (sometimes much slower).
     更改算法以找到较小的更改集。这使得diff变慢(有时慢得多)。
       -D name
              Make merged if-then-else format output, conditional on the preproces-
              sor macro name.
     以预处理器宏名为条件,将if-then-else格式输出为合并格式。
       -e
       --ed   Make output that is a valid ed script.
           生成有效的ED脚本的输出。
       --exclude=pattern/--排除=模式
              When comparing directories, ignore  files  and  subdirectories  whose
              basenames match pattern.
     比较目录时,忽略其基名称与模式匹配的文件和子目录。
    
       --exclude-from=file/--排除=文件
              When  comparing  directories,  ignore  files and subdirectories whose
              basenames match any pattern contained in file.
     比较目录时,忽略其基名称与文件中包含的任何模式匹配的文件和子目录。
       --expand-tabs/--展开标签
              Expand tabs to spaces in the output, to  preserve  the  alignment  of
              tabs in the input files.
     将选项卡展开为输出中的空格,以保留输入文件中选项卡的对齐方式。
    
       -f     Make  output  that looks vaguely like an ed script but has changes in
              the order they appear in the file.
     生成看起来类似于ED脚本但在文件中显示顺序发生更改的输出。
       -F regexp
              In context and unified format, for each  hunk  of  differences,  show
              some of the last preceding line that matches regexp.
     在上下文和统一格式中,对于每一大块差异,显示前面与regexp匹配的最后一行。
    
       --forward-ed
              Make  output  that looks vaguely like an ed script but has changes in
              the order they appear in the file.
     生成看起来类似于ED脚本但在文件中显示顺序发生更改的输出。
       -h     This option currently has no effect; it is present for Unix  compati-
              bility.
     此选项当前不起作用;它是为了与Unix兼容而存在的。
       -H     Use  heuristics  to  speed handling of large files that have numerous
              scattered small changes.
     使用启发式方法来加速处理具有许多分散的小更改的大文件。
       --horizon-lines=lines
              Do not discard the last lines lines of  the  common  prefix  and  the
              first lines lines of the common suffix.
     不要丢弃公共前缀的最后一行和公共后缀的第一行。
       -i     Ignore changes in case; consider upper- and lower-case letters equiv-
              alent.
     忽略大小写中的更改;考虑大小写相等。
    
       -I regexp
              Ignore changes that just insert or delete lines that match regexp.
     忽略只插入或删除与regexp匹配的行的更改。
       --ifdef=name
              Make merged if-then-else format output, conditional on the preproces-
              sor macro name.
     以预处理器宏名为条件,将if-then-else格式输出为合并格式。
       --ignore-all-space
              Ignore white space when comparing lines.
     比较行时忽略空白。
       --ignore-blank-lines
              Ignore changes that just insert or delete blank lines.
     忽略只插入或删除空行的更改。
       --ignore-case
              Ignore  changes  in  case;  consider  upper- and lower-case to be the
              same.
     忽略大小写中的更改;将大小写视为相同。
       --ignore-matching-lines=regexp
              Ignore changes that just insert or delete lines that match regexp.
     忽略只插入或删除与regexp匹配的行的更改。
    
       --ignore-space-change
              Ignore changes in amount of white space.
     忽略空白量的更改。
       --initial-tab
              Output a tab rather than a space before the text of a line in  normal
              or  context format.  This causes the alignment of tabs in the line to
              look normal.
     以普通格式或上下文格式输出行文本前的制表符,而不是空格。这会使行中的制表符对齐看起来正常。
       -l     Pass the output through pr to paginate it.
     通过pr传递输出以对其分页。
       -L label
       --label=label
              Use label instead of the file name in the context format and  unified
              format headers.
     在上下文格式和统一格式头中使用标签而不是文件名。
       --left-column/左列
              Print  only  the left column of two common lines in side by side for-
              mat.
     仅以并排格式打印两个公用行的左列。
       --line-format=format
              Use format to output all input lines in in-then-else format.
     使用FORMAT以THEN ELSE格式输出所有输入行。
       --minimal
              Change the algorithm to perhaps find a smaller set of changes.   This
              makes diff slower (sometimes much slower).
     更改算法以找到较小的更改集。这使得diff变慢(有时慢得多)。
       -n     Output  RCS-format  diffs; like -f except that each command specifies
              the number of lines affected.
     输出rcs格式差异;类似于-f,但每个命令指定受影响的行数。
       -N
       --new-file
              In directory comparison, if a file is found in  only  one  directory,
              treat it as present but empty in the other directory.
     在目录比较中,如果只在一个目录中找到一个文件,则在另一个目录中将其视为存在但为空。
       --new-group-format=format
              Use format to output a group of lines taken from just the second file
              in if-then-else format.
     使用format以if-then-else格式输出仅从第二个文件中提取的一组行。
       --new-line-format=format
              Use format to output a line taken from just the second  file  in  if-
              then-else format.
     使用format以if-then-else格式从第二个文件中输出一行。
       --old-group-format=format
              Use  format to output a group of lines taken from just the first file
              in if-then-else format.
     使用format以if-then-else格式输出仅从第一个文件中提取的一组行。
       --old-line-format=format
              Use format to output a line taken from just the  first  file  in  if-
              then-else format.
     使用format以if-then-else格式从第一个文件中输出一行。
       -p     Show which C function each change is in.
     显示每个更改的C函数。
       -P     When  comparing  directories,  if  a  file appears only in the second
              directory of the two, treat it as present but empty in the other.
     比较目录时,如果一个文件只出现在两个目录中的第二个目录中,则将其视为存在,但在另一个目录中为空。
       --paginate
              Pass the output through pr to paginate it.
     通过pr传递输出以对其分页。
       -q     Report only whether the files differ, not the details of the  differ-
              ences.
     只报告文件是否不同,而不报告差异的详细信息。
       -r     When  comparing  directories,  recursively compare any subdirectories
              found.
     比较目录时,递归地比较找到的所有子目录。
    
       --rcs  Output RCS-format diffs; like -f except that each  command  specifies
              the number of lines affected.
     输出RCS格式差异;类似-F,除了每个命令指定受影响的行数。
       --recursive
              When  comparing  directories,  recursively compare any subdirectories
              found.
     比较目录时,递归地比较找到的所有子目录。
       --report-identical-files/报告相同的文件
       -s     Report when two files are the same.
     当两个文件相同时报告。
       -S file
              When comparing directories, start with the file file.  This  is  used
              for resuming an aborted comparison.
     比较目录时,从文件文件开始。这用于恢复中止的比较。
       --from-file=file
              Compare file to all operands.  file can be a directory.
     将文件与所有操作数进行比较。文件可以是目录。
       --to-file=file
              Compare all operands to file. file can be a directory.
     将所有操作数与文件进行比较。文件可以是目录。
       --sdiff-merge-assist
              Print  extra  information to help sdiff.  sdiff uses this option when
              it runs diff.  This option is not intended for users to use directly.
     打印额外信息以帮助SDiff。sdiff在运行diff时使用此选项。此选项不供用户直接使用。
       --show-c-function
              Show which C function each change is in.
     显示每个更改的C函数。
       --show-function-line=regexp
              In  context  and  unified  format, for each hunk of differences, show
              some of the last preceding line that matches regexp.
     在上下文和统一格式中,对于每一大块差异,显示前面与regexp匹配的最后一行。
       --side-by-side
              Use the side by side output format.
     使用并排输出格式。
       --speed-large-files
              Use heuristics to speed handling of large files  that  have  numerous
              scattered small changes.
     使用启发式方法来加速处理具有许多分散的小更改的大文件。
       --starting-file=file
              When  comparing  directories, start with the file file.  This is used
              for resuming an aborted comparison.
     比较目录时,从文件文件开始。这用于恢复中止的比较。
       --suppress-common-lines
              Do not print common lines in side by side format.
     不要并排打印公共行。
       -t     Expand tabs to spaces in the output, to  preserve  the  alignment  of
              tabs in the input files.
     将选项卡展开为输出中的空格,以保留输入文件中选项卡的对齐方式。
       -T     Output  a tab rather than a space before the text of a line in normal
              or context format.  This causes the alignment of tabs in the line  to
              look normal.
     以普通格式或上下文格式输出行文本前的制表符,而不是空格。这会使行中的制表符对齐看起来正常。
       --text Treat  all  files as text and compare them line-by-line, even if they
              do not appear to be text.
     将所有文件视为文本并逐行比较,即使它们看起来不是文本。
       -u     Use the unified output format.
     使用统一的输出格式。
       --unchanged-group-format=format
              Use format to output a group of common lines taken from both files in
              if-then-else format.
     使用format以if-then-else格式输出两个文件中的一组公共行。
       --unchanged-line-format=format
              Use format to output a line common to both files in if-then-else for-
              mat.
     使用format以if-then-else格式输出两个文件共用的行。
       --unidirectional-new-file
              When comparing directories, if a file  appears  only  in  the  second
              directory of the two, treat it as present but empty in the other.
     比较目录时,如果一个文件只出现在两个目录中的第二个目录中,则将其视为存在,但在另一个目录中为空。
       -U lines
       --unified[=lines]
              Use  the  unified  output format, showing lines (an integer) lines of
              context, or three if lines is not given.  For proper operation, patch
              typically needs at least two lines of context.
     使用统一的输出格式,显示上下文的行(整数),如果没有给出行,
     则使用三行。为了正确操作,补丁通常需要至少两行上下文。
       -v
       --version
              Output the version number of diff.
     输出diff的版本号。
       -w     Ignore white space when comparing lines.
     比较行时忽略空白。
       -W columns
       --width=columns
              Use an output width of columns in side by side format.
     使用并排格式的列的输出宽度。
       -x pattern
              When  comparing  directories,  ignore  files and subdirectories whose
              basenames match pattern.
     在比较目录时,忽略文件名和子目录的基本目录匹配模式。
       -X file
              When comparing directories, ignore  files  and  subdirectories  whose
              basenames match any pattern contained in file.
     比较目录时,忽略其基名称与文件中包含的任何模式匹配的文件和子目录。
       -y     Use the side by side output format./使用并排输出格式。
SEE ALSO/参照
       cmp(1), comm(1), diff3(1), ed(1), patch(1), pr(1), sdiff(1).
DIAGNOSTICS/系统诊断
       An  exit  status  of 0 means no differences were found, 1 means some differ-
       ences were found, and 2 means trouble.
    退出状态为0表示未发现差异,1表示发现一些差异,2表示有问题。
GNU Tools                          22sep1993                           DIFF(1)
posted @ 2019-05-08 16:31  zhouhaiwu  阅读(159)  评论(0编辑  收藏  举报