diff - display line-by-line differences between pairs of text files
ddiiffff [--##] [--aabbBBccddeeffhhHHiillnnNNpprrssttTTuuvvww] [--CC_l_i_n_e_s] [--FF_r_e_g_e_x_p] [--II_r_e_g_e_x_p]
[--LL_l_a_b_e_l [--LL_l_a_b_e_l]] [--SS_f_i_l_e] [--DD_s_y_m_b_o_l] _p_a_t_h_1_ _p_a_t_h_2
The ddiiffff installed on this system is the GNU diff. This version of
ddiiffff provides all the features of BSD's ddiiffff in addition to
numerous additional features.
ddiiffff is a _d_i_f_f_e_r_e_n_t_i_a_l file comparator. When run on regular files,
and when comparing text files that differ during directory
comparison (see the notes below on comparing directories), ddiiffff
tells what lines must be changed in the files to bring them into
agreement. Except in rare circumstances, ddiiffff finds a smallest
sufficient set of differences. If neither _p_a_t_h_1 nor _p_a_t_h_2 is a
directory, either may be given as "-", in which case the standard
input is used. If _p_a_t_h_1 is a directory, a file in that directory
whose filename is the same as the filename of _p_a_t_h_2 is used (and
There are several options for output format; the default output
format contains lines of these forms:
These lines resemble eedd(1) commands to convert _p_a_t_h_1 into _p_a_t_h_2.
The numbers after the letters pertain to _p_a_t_h_2. In fact, by
exchanging aa for dd and reading backward one may ascertain
equally how to convert _p_a_t_h_2 into _p_a_t_h_1. As in eedd(1), identical
pairs, where _n_1 = _n_2 or _n_3 = _n_4, are abbreviated as a single
Following each of these lines come all the lines that are
affected in the first file flagged by "<", then all the lines
that are affected in the second file flagged by ">".
If both arguments are directories, ddiiffff sorts the contents of
the directories by name, and then runs the regular file ddiiffff
program as described above on text files which are different.
Binary files which differ, common subdirectories, and files
which appear in only one directory are listed.
This diff has these additional (non-BSD) features:
--aa Always treat files as text and compare them line-by-line,
even if they do not appear to be ASCII.
--BB Ignore changes that just insert or delete blank lines.
--CC_# Request -c format and specify number of context lines.
--FF_r_e_g_e_x_p In context format, for each unit of differences, show some
of the last preceding line that matches the specified
--HH Use heuristics to speed handling of large files that have
numerous scattered small changes. The algorithm becomes
asymptotically linear for such files!
--II_r_e_g_e_x_p Ignore changes that just insert or delete lines that match
the specified regexp.
--LL_l_a_b_e_l Use the specified label in file header lines output by the
--cc option. This option may be given zero, one, or two
times, to affect neither label, just the first file's
label, or both labels. A file's default label is its
name, a tab, and its modification date.
--NN In directory comparison, if a file is found in only one
directory, treat it as present but empty in the other
--pp Equivalent to -c -F'^[_a-zA-Z]'. This is useful for C
code because it shows which function each change is in.
--TT Print 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.
--uu[_#] Produce unified style output with _# context lines
(default 3). This style is like --cc, but it is more
compact because context lines are printed only once.
Lines from just the first file are marked "-"; lines from
just the second file are marked "+".
--vv Print the version string before any other output.
The following features are BSD standard:
--bb Ignore trailing blanks (SPACE and TAB characters) and
treat all other strings of blanks as equivalent.
--ii Ignore the case of letters; for example, 'A' will compare
equal to 'a'.
--tt Expand TAB characters in output lines. Normal or --cc
output adds character(s) to the front of each line which
may alter the indentation of the original source lines and
make the output listing difficult to interpret. This
option will preserve the original source's indentation.
--ww Ignore all blanks (SPACE and TAB characters); for example,
"if ( a == b )" will compare equal to "if(a==b)".
The following four options are mutually exclusive:
--cc[_#] Produce a listing of differences with lines of context.
The default is to present 3 lines of context and may be
changed, (to 10, for example), by --cc1100. With --cc the
output format is modified slightly: output begins with
identification of the files involved and their creation
dates, then each change is separated by a line with a
dozen **s. The lines removed from _p_a_t_h_1 are marked with
"-"; those added to _p_a_t_h_2 are marked "+". Lines which are
changed from one file to the other are marked in both
files with "!".
Changes which lie within
grouped together on output. This is a change from the
previous ddiiffff --cc but the resulting output is usually much
easier to interpret.
--DD_s_y_m_b_o_l Output a file containing ##iiffddeeff directives based on _s_y_m_b_o_l
which will allow creating either a version identical to
_p_a_t_h_1 (_s_y_m_b_o_l not defined) or _p_a_t_h_2 (_s_y_m_b_o_l defined).
--ee Produce a script of aa, cc and dd commands for the editor eedd,
which will recreate _p_a_t_h_2 from _p_a_t_h_1.
In connection with --ee, the following shell program may
help maintain multiple versions of a file. Only an
ancestral file ($1) and a chain of version-to-version eedd
scripts ($2, $3, ...) made by ddiiffff need be on hand. A
"latest version" appears on the standard output.
(shift; cat $*; echo '1,$p') | ed - $1
Extra commands are added to the output when comparing
directories with --ee, so that the result is a sshh script for
converting text files which are common to the two
directories from their state in _d_i_r_e_c_t_o_r_y_1 to their state
--ff Produce a script similar to that of --ee, not useful with
eedd, which is in the opposite order.
--nn Produce a script similar to that of --ee, but in the
opposite order and with a count of changed lines on each
insert or delete command.
--hh Do a fast, half-hearted job. It works only when changed
stretches are short and well separated, but does work on
files of unlimited length.
Options when comparing directories are:
--ll Long output format; each text file ddiiffff is piped through
pprr(1V) to paginate it, other differences are remembered
and summarized after all text file differences are
--rr Apply ddiiffff recursively to common subdirectories
--ss Report files which are the same, which are otherwise not
--SS_n_a_m_e Start a directory ddiiffff in the middle, beginning with file
cccc(1V), ccmmpp(1), ccoommmm(1), ccpppp(1), ddiiffff33(1V), eedd(1), pprr(1V)
Exit status is 0 for no differences, 1 for some differences, 2 for
_M_i_s_s_i_n_g_ _n_e_w_l_i_n_e_ _a_t_ _e_n_d_ _o_f_ _f_i_l_e_ _X Indicates that the last line of
file _X did not have a NEWLINE. If the lines are different, they
will be flagged and output, although the output will seem to
indicate they are the same.
Editing scripts produced under the --ee or --ff option are naive about
creating lines consisting of a single '.'.
When comparing directories with the --bb, --ww or --ii options specified,
ddiiffff first compares the files (as in ccmmpp(1), and then runs the
regular ddiiffff algorithm if they are not equal. This may cause a
small amount of spurious output if the files then turn out to be
identical because the only differences are insignificant blank
string or case differences.
The --DD option ignores existing preprocessor controls in the source
files, and can generate ##iiffddeeffss's with overlapping scope. The
output should be checked by hand, or run through cccc --EE (see cccc(1V))
and then ddiiffffed with the original source files. Discrepancies
revealed should be corrected before compilation.
The MS-DOS and OS/2 versions sometimes get confused by files that