diff3 - display line-by-line differences between 3 files
diff3 [ -exEX3 ] filename1 filename2 filename3
SYSTEM V SYNOPSIS
/usr/5bin/diff3 [ -ex3 ] filename1 filename2 filename3
The System V version of this command is available with the System V
software installation option. Refer to for information on how to
install optional software.
diff3 compares three versions of a file, and publishes disagreeing
ranges of text flagged with these codes:
==== All three files differ
====1 filename1 is different
====2 filename2 is different
====3 filename3 is different
The types of differences between a given range within the given files
are indicated in one of these ways:
f:n1a Text is to be appended after line number n1 in file
f, where f = 1, 2, or 3.
f:n1,n2c 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 indi-
cation. When the contents of two files are identical, the contents of
the lower-numbered file is suppressed.
The options to diff3 instruct it to produce a script for the editor ed,
rather than a list of differences. This script will incorporate some
or all of the differences between filename2 and filename3 into file-
name1. This script will not include a w or q command at the end, so
that it will not write out the changed file.
-e Produce a script that will incorporate all changes between file-
name2 and filename3, that is, the changes that normally would be
flagged `====' and `====3'.
-x Produce a script that will incorporate only changes flagged
-3 Produce a script that will incorporate only changes flagged
-E Produce a script that will incorporate all changes between file-
name2 and filename3, but treat overlapping changes (that is,
changes that would be flagged with ==== in the normal listing)
differently. The overlapping lines from both files will be
inserted by the edit script, bracketed by <<<<<<<<<<<< and >>>>>>>>>>>>
-X Produce a script that will incorporate only changes flagged
====, but treat these changes in the manner of the -E option.
For example, suppose lines 7-8 are changed in both filename1 and
filename2. Applying the edit script generated by the command
diff3 -E filename1 filename2 filename3
to filename1 results in the following file.
rest of filename1
SYSTEM V OPTIONS
The System V version of diff3 does not support the -E and -X options.
The script produced by the -e, -x, and -3 options does include a w and
q command at the end, so that it will write out the changed file.
The following command will incorporate all the changes between file-
name2 and filename3 into filename1, and print the resulting file to the
standard output. If the System V version of diff3, is used, filename1
will be replaced with the resulting file.
(diff3 -e filename1 filename2 filename3; echo '1,$p') | ed - filename1
Text lines that consist of a single `.' will defeat a -e option.
9 September 1987 DIFF3(1V)