diff3 - 3-way differential file comparison
diff3 [-aexEX3] file1 file2 file3
The diff3 utility compares the contents of three different
versions of a
file, file1, file2 and file3, writing the result to the
The options describe different methods of merging and purging the separate
versions into a new file. diff3 is used by rcs(1) to
versions or create new versions.
The options are as follows:
-a Treat all files as ASCII.
-e Produces output in a form suitable as an input
script for the
ed(1) utility. The script may then be used to merge
common between all three files and differences specific to file1
and file3. In other words, the -e option ignores
specific to file1 and file2, and those specific to
file3. It is useful for backing out changes specific to file2
-x Produces an output script suitable for ed(1) with
only to all three versions.
-3 Produces an output script suitable for ed(1) with
only to file3.
-E, -X Similar to -e and -x, respectively, but treat overlapping changes
(i.e., changes that would be noted with ==== in the
differently. The overlapping lines from both
files will be
inserted by the edit script, bracketed by "<<<<<<"
The -E option is used by RCS merge(1) to ensure that overlapping changes
in the merged files are preserved and brought to someone's
For example, suppose lines 7-8 are changed in both file1 and
the edit script generated by the command
$ diff3 -E file1 file2 file3
to file1 results in the file:
rest of file1
The default output of diff3 makes notation of the differences between all
files, and those differences specific to each pair of files.
are described by the commands necessary for ed(1) to create
target from the different versions. See diff(1) for a description of the
==== The lines beneath this notation are ranges of lines
which are different
between all files.
====n The lines beneath this notation are ranges of lines
which are exclusively
different in file n.
TMPDIR If the environment variable TMPDIR exists, diff3
will use the directory
specified by TMPDIR as the temporary directory.
/tmp/d3a.XXXXXXXXXX temporary file
/tmp/d3b.XXXXXXXXXX temporary file
/usr/libexec/diff3prog the actual executable
diff(1), ed(1), merge(1), rcs(1)
A diff3 command appeared in Version 7 AT&T UNIX.
The -e option cannot catch and change lines which have `.'
as the first
and only character on the line. The resulting script will
fail on that
line as `.' is an ed(1) editing command.
OpenBSD 3.6 April 18, 1994
[ Back ]