man(1) Manual page archive

     diff - differential file comparator

     diff [ - ] name1 name2

     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 back-
     ward 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 con-
     tents of the first file into the contents of the second.  In
     this connection, the following shell program may help main-
     tain 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 ver-
     sion' appears on the standard output.

          (cat $2 ... $9; echo "1,$p") | ed - $1

     Except for occasional `jackpots', diff finds a smallest suf-
     ficient set of file differences.

     cmp (I), comm (I), ed (I)

     `jackpot' - To speed things up, the program uses hashing.
     You have stumbled on a case where there is a chance that
     this has resulted in a difference being called where none
     actually existed.  Sometimes reversing the order of files
     will make a jackpot go away.

     Editing scripts produced under the - option are naive about
     creating lines consisting of a single `.'.