32v 1m diff
From Computer History Wiki
DIFF(1) UNIX Programmer's Manual DIFF(1)
NAME
diff - differential file comparator
SYNOPSIS
diff [ -efbh ] file1 file2
DESCRIPTION
_D_i_f_f tells what lines must be changed in two files to bring them into agreement. If _f_i_l_e_1 (_f_i_l_e_2) is `-', the standard input is used. If _f_i_l_e_1 (_f_i_l_e_2) is a directory, then a file in that directory whose file-name is the same as the file- name of _f_i_l_e_2 (_f_i_l_e_1) is used. The normal output 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 _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 `>'.
The -b option causes trailing blanks (spaces and tabs) to be ignored and other strings of blanks to compare equal.
The -e option produces a script of _a, _c and _d commands for the editor _e_d, which will recreate _f_i_l_e_2 from _f_i_l_e_1. The -f option produces a similar script, not useful with _e_d, in the opposite order. In connection with -e, the following shell program may help maintain multiple versions of a file. Only an ancestral file ($1) and a chain of version-to-version _e_d scripts ($2,$3,...) made by _d_i_f_f need be on hand. A `latest version' appears on the standard output.
(shift; cat $*; echo '1,$p') | ed - $1
Except in rare circumstances, _d_i_f_f finds a smallest suffi- cient set of file differences.
Option -h does 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 -e and -f are unavailable with -h.
FILES
/tmp/d????? /usr/lib/diffh for -h
SEE ALSO
cmp(1), comm(1), ed(1)
DIAGNOSTICS
Exit status is 0 for no differences, 1 for some, 2 for trou- ble.
BUGS
Editing scripts produced under the -e or -f option are naive about creating lines consisting of a single `.'.