Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

comm(1)

diff(1)

ed(1)

DIFF3(1)                             BSD                              DIFF3(1)



NAME
     diff3 - three-way differential file comparison

SYNOPSIS
     diff3 [ -exEX3 ] file1 file2 file3

DESCRIPTION
     diff3 compares three versions of a file, and publishes disagreeing ranges
     of text flagged with the following codes:

     ====            All three files differ.

     ====1           file1 is different.

     ====2           file2 is different.

     ====3           file3 is different.

     diff3 indicates the type of change that occurred in converting a given
     range of a given file to some other, in one of these ways:

     f : n1 a        Text is to be appended after line number n1 in file f,
                     where f is 1, 2, or 3.

     f : n1 , n2 c   Text is to be changed in the range line n1 to line n2.
                     If n1 = n2, the range may be abbreviated to n1.

     The original contents of the range follows immediately after a c
     indication.  When the contents of two files are identical, the contents
     of the lower-numbered file is suppressed.

OPTIONS
     -e        Produce a script for the editor ed(1) that will incorporate
               into file1 all changes between file2 and file3; that is,
               changes that are normally flagged ==== and ====3.

     -E        Similar to the -e option. Produce a script for the text editor,
               but treat overlapping changes (that is, changes that are
               flagged with ==== in the normal listing) differently from the
               -e option.  The edit script inserts the overlapping lines from
               both files, bracketed by "<<<<<<" and ">>>>>>" lines.  RCS
               merge uses the -E option to ensure that overlapping changes in
               the merged files are preserved and brought to someone's
               attention.

     -x (-3)   Produce a script to incorporate only changes flagged ====
               (====3).

     -X        Produce a script for the text editor ed, similar to the -x
               option, but treat overlapping changes (that is, changes that
               are flagged with ==== in the normal listing) differently.  The
               edit script inserts the overlapping lines from both files,
               bracketed by "<<<<<<" and ">>>>>>" lines.

     The following command applies the resulting script to file1.

                (cat script; echo '1,$p') | ed - file1

EXAMPLE
     For example, suppose lines seven and eight are changed in both file1 and
     file2.
          % diff3 -E file1 file2 file3 > edscript
          % (cat edscript; echo '1,$p') | ed - file1
          lines 1-6
          of file1
          <<<<<<< file1
          lines 7-8
          of file1
          =======
          lines 7-8
          of file3
          >>>>>>> file3
          rest of file1


BUGS
     Text lines that consist of a single dot (.) defeat -e.

FILES
     /tmp/d3?????
     /usr/lib/diff3

SEE ALSO
     comm(1), diff(1), ed(1)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026