DIFF(I) 5/15/74 DIFF(I)
NAME
diff - differential file comparator
SYNOPSIS
diff [ - ] name1 name2
DESCRIPTION
Diff tells what lines must be changed in two files to bring
them into agreement. The normal output contains lines of
these forms:
n1 a n3,n4
n1,n2 d n3
n1,n2 c n3,n4
These lines resemble ed commands to convert file name1 into
file name2. The numbers after the letters pertain to file
name2. In fact, by exchanging `a' for `d' and reading
backward one may ascertain equally how to convert file name2
into name1. As in ed, identical pairs where n1 = n2 or n3 =
n4 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 `.'.
Under the - option, the output of diff is a script of a, c
and d commands for the editor ed, which will change the
contents of the first file into the contents of the second.
In this connection, the following shell program may help
maintain multiple versions of a file. Only an ancestral
file ($1) and a chain of version-to-version ed scripts
($2,$3,...) made by diff need be on hand. A `latest
version' appears on the standard output.
(cat $2 ... $9; echo "1,$p") | ed - $1
Diff does an optimal and unfailing job of detecting the file
differences, and also reports these differences side-by-
side. However, diff uses a quadratic algorithm that usually
slows to a crawl on 2000-line files.
SEE ALSO
cmp (I), comm (I), ed (I)
DIAGNOSTICS
`can't open input'
`arg count'
`jackpot' - To speed things up, the program uses hashing.
You have stumbled on a case where there is a minuscule
chance that this has resulted in an unnecessarily long list
of differences being published. It's a curio that we'd like
to see.
BUGS
Editing scripts produced under the - option are naive about
creating lines consisting of a single `.'.