2.9BSD/usr/man/cat1/diff.1
DIFF(1) UNIX Programmer's Manual DIFF(1)
NAME
diff - differential file and directory comparator
SYNOPSIS
diff [ -l ] [ -r ] [ -s ] [ -cefh ] [ -b ] dir1 dir2
diff [ -cefh ] [ -b ] file1 file2
diff [ -D_s_t_r_i_n_g ] [ -b ] file1 file2
DESCRIPTION
If both arguments are directories, _d_i_f_f sorts the contents
of the directories by name, and then runs the regular file
_d_i_f_f algorithm (described below) on text files which are
different. Binary files which differ, common subdirec-
tories, and files which appear in only one directory are
listed. Options when comparing directories are:
-l long output format; each text file _d_i_f_f is piped
through _p_r(1) to paginate it, other differences are
remembered and summarized after all text file differ-
ences are reported.
-r causes application of _d_i_f_f recursively to common sub-
directories encountered.
-s causes _d_i_f_f to report files which are the same, which
are otherwise not mentioned.
-Sname
starts a directory _d_i_f_f in the middle beginning with
file _n_a_m_e.
When run on regular files, and when comparing text files
which differ during directory comparison, _d_i_f_f tells what
lines must be changed in the files to bring them into agree-
ment. Except in rare circumstances, _d_i_f_f finds a smallest
sufficient set of file differences. If neither _f_i_l_e_1 nor
_f_i_l_e_2 is a directory, then either may be given as `-', in
which case the standard input is used. If _f_i_l_e_1 is a direc-
tory, then a file in that directory whose file-name is the
same as the file-name of _f_i_l_e_2 is used (and vice versa).
There are several options for output format; the default
output format contains lines of these forms:
_n_1 a _n_3,_n_4
_n_1,_n_2 d _n_3
_n_1,_n_2 c _n_3,_n_4
These lines resemble _e_d commands to convert _f_i_l_e_1 into
_f_i_l_e_2. The numbers after the letters pertain to _f_i_l_e_2. In
fact, by exchanging `a' for `d' and reading backward one may
ascertain equally how to convert _f_i_l_e_2 into _f_i_l_e_1. As in
Printed 7/25/83 1
DIFF(1) UNIX Programmer's Manual DIFF(1)
_e_d, identical pairs where _n_1 = _n_2 or _n_3 = _n_4 are abbreviated
as a single number.
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 `>'.
Except for -b, which may be given with any of the others,
the following options are mutually exclusive:
-e producing a script of _a, _c and _d commands for the
editor _e_d, which will recrea