.TH diff3 "" "" Command
.PC "Summarize differences among three files"
\fBdiff3 [\-ex3] \fIfile1 file2 file3\fR
.PP
.HS
.SH Options:
.IC \fB\-e\fR
Make \fBed\fR script to change \fIfile2\fR and \fIfile\fR
to \fIfile1\fR (changes marked with \fB====\fR or \fB====3\fR)
.IC \fB\-x\fR
Above script with changes marked \fB====\fR
(all different)
.IC \fB\-3\fR
Above script with changes marked \fB====3\fR (\fIfile3\fR different)
.HE
.B diff3
summarizes the differences among three text files.
Each difference encountered is headed by one of
the following separators, which categorizes how many of the three
input files differ in a given range.
The headers are as follows
.IP \fB====\fR 0.75i
All of the files are different.
.IP \fB====\fIn\fR
Only the
.IR n th
file differs,
where
.I n
may be 1, 2, or 3.
.PP
For each set of changes marked as above,
the actual change is indicated for each file
using a notation similar to commands to
.BR ed .
For each
.I filen
the following is printed:
.IP "\fIn: l\fBa\fR" 0.75i
Text is to be appended after line
.I l
in
.IR filen .
.IP "\fIn: l,m\fBc\fR"
The text from line
.I l
to line
.I m
is to be changed for
.IR filen .
The original text from
.I filen
follows this line.
If this text is identical for two of the files,
only the latter (higher numbered) of the two
is printed.
.PP
Options are available to print
a script of commands to
.BR ed .
Option
.B \-e
tells
.B diff3
to generate a script that makes all changes between
.I file2
and
.I file3
to
.IR file1 .
This script is based upon all changes flagged with the separators
.B ====
or
.BR ====3 ,
as described above.
.PP
The option
.B \-x
prints only those changes where all three files differ,
i.e., those flagged with
.BR ==== .
.PP
The option
.B \-3
requests only those changes where
.I file3
differs.
.SH Example
The following command sequence produces a script,
applies it to
.I file1,
and sends the result to the standard output.
.DM
	(diff3 \-e file1 file2 file3; echo '1,$p') | ed \- file1
.DE
.SH Files
.B /tmp/d3*
.br
.B /usr/lib/diff3
.SH "See Also"
.Xr "commands," commands
.Xr "diff," diff
.Xr "ed" ed
.SH Diagnostics
An exit status of zero indicates all three files were identical,
one indicates differences, and two indicates some other failure.
