您的位置:首页 > 其它

diff的man帮助文档翻译

2013-02-25 07:00 381 查看
MicrosoftInternetExplorer402DocumentNotSpecified7.8Normal0

DIFF(1) GNU Tools DIFF(1)

NAME

diff - find differences between two files

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比较两个文件from-file, to-file的差异。如果以"-"为文件名,则以标准输入为输入。
作为一个特例,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 -.

如果"from-file"是一个路径名,而"to-file"不是路径名时,则diff比较的是"from-file"路径下和"to-file"相同名
的文件。反过来也是一样。这时,非路径文件不能是"-"。

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 nameless and the notion of ''file with the same name''

does not apply.

如果"from-file", "to-file"都是路径名,diff以字母顺序比较两个路径下相对就的文件。这个比较不会对目
录进行递进深入,除非指定了"-r "或"--recursive"选项。

diff options begin with -, so normally from-file and to-file may not begin with -. However, -- as an argu-

ment by itself treats the remaining arguments as file names even if they begin with -.

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 --. Mul-

tiple 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.

-lines Show lines (an integer) lines of context. This option does not specify an output format by itself;

it has no effect unless it is combined with -c or -u. This option is obsolete. For proper opera-

tion, patch typically needs at least two lines of context.

-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.

忽略空行。

-q

--brief

Report only whether the files differ, not the details of the differences.

仅报告文件是否有差异,不进行细节的比较

-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.

在使用上下文输出格式时,显示上下文的行数。Patch通常需要至少两行上下文行

--changed-group-format=format

Use format to output a line group containing differing lines from both files in if-then-else format.

-d Change the algorithm to perhaps find a smaller set of changes. This makes diff slower (sometimes

much slower).

-D name

Make merged if-then-else format output, conditional on the preprocessor macro name.

-e

--ed Make output that is a valid ed script.

--exclude=pattern

When comparing directories, ignore files and subdirectories whose basenames match pattern.

当比较文件路径时,忽略和"pattern"匹配的基本名的文件或子路径

--exclude-from=file

When comparing directories, ignore files and subdirectories whose basenames match any pattern
contained in file.

当比较文件路径时,忽略文件"file"中指定的和基本名相匹配的任何文件名或子路径。

--expand-tabs

Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.

将tabs扩展成空格。

-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.

-h This option currently has no effect; it is present for Unix compatibility.

-H

--speed-large-files

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 equivalent.

忽略大小写的区别

-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 preprocessor macro name.

对指定了"name"的进行宏扩展输出

--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.

在标准或上下文格式中,在输出的文本前用Tab代替空格。

-l Pass the output through pr to paginate it.

-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 format.

--line-format=format

Use format to output all input lines in in-then-else format.

--minimal

Change the algorithm to perhaps find a smaller set of changes.This makes diff slower (sometimes

much slower).

-n Output RCS-format diffs; like -f except that each command specifies the number of lines affected.

-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.

-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.

--new-line-format=format

Use format to output a line taken from just the second file in if-then-else format.

--old-group-format=format

Use format to output a group of lines taken from just the first file in if-then-else format.

--old-line-format=format

Use format to output a line taken from just the first file in if-then-else format.

--paginate

Pass the output through pr to paginate it.

-r

--recursive

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.

--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 compari-

son.

比较目录时,指定起始的文件为"file"。它通常用来重启一个失败的比较

--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.

-p

--show-c-function

Show which C function each change is in.

--show-function-line=regexp

In context and unified format, for each hunk of differences, show some of the last preceding line

that matches regexp.

--side-by-side

Use the side by side output format.

--starting-file=file

When comparing directories, start with the file file. This is used for resuming an aborted compari-

son.

--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.

--unchanged-line-format=format

Use format to output a line common to both files in if-then-else format.

--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 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.

--unchanged-line-format=format

Use format to output a line common to both files in if-then-else format.

--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]

--text Treat all files as text and compare them line-by-line, even if they do not appear to be text.

-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.

-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 differences were found, and 2 means trou-

ble.

GNU Tools 22sep1993 DIFF(1)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: