BSD 4_3 release
[unix-history] / usr / man / man1 / diff3.1
CommitLineData
95f51977 1.\" @(#)diff3.1 6.2 (Berkeley) 8/20/85
eadf9268 2.\"
95f51977 3.TH DIFF3 1 "August 20, 1985"
eadf9268
KM
4.AT 3
5.SH NAME
6diff3 \- 3-way differential file comparison
7.SH SYNOPSIS
8.B diff3
9[
6ed3f60e 10.B \-exEX3
eadf9268
KM
11]
12file1 file2 file3
13.SH DESCRIPTION
14.I Diff3
15compares three versions of a file,
16and publishes disagreeing ranges of text
17flagged with these codes:
18.TP 16
19====
20all three files differ
21.TP 16
22====1
23.IR file1 " is different"
24.TP 16
25====2
26.IR file2 " is different"
27.TP 16
28====3
29.IR file3 " is different"
30.PP
31The type of change suffered in converting a given range
32of a given file to some other is
33indicated in one of these ways:
34.TP 16
35.IB f " : " n1 " a"
36Text is to be appended after line number
37.I n1
38in file
39.I f,
40where
41.I f
42= 1, 2, or 3.
43.TP 16
44.IB f " : " n1 " , " n2 " c"
45Text is to be
46changed in the range line
47.I n1
48to line
49.IR n2 .
50If
51.I n1
52=
53.I n2,
54the range may be abbreviated to
55.IR n1 .
56.PP
57The original contents of the range follows immediately
58after a
59.B c
60indication.
61When the contents of two
62files are identical, the contents of the lower-numbered
63file is suppressed.
64.PP
65Under the
66.B \-e
67option,
68.I diff3
69publishes a script for the editor
70.I ed
71that will incorporate into
72.I file1
73all changes between
74.I file2
75and
76.I file3,
77.IR i.e .
78the changes that normally would be flagged ==== and ====3.
79Option
80.B \-x
81(\fB\-3\fR)
82produces a script to incorporate
83only changes flagged ==== (====3).
84The following command will apply the resulting script to
85`file1'.
86.PP
87.ti 16n
88(cat script; echo \'1,$p\') \(bv ed \- file1
6ed3f60e
VJ
89.PP
90The
91.B \-E
92and
93.B \-X
94are similar to
95.B \-e
96and
97.BR \-x ,
98respectively, but treat overlapping changes (i.e., changes that would
99be flagged with ==== in the normal listing) differently. The overlapping
100lines from both files will be inserted by the edit script, bracketed
101by "<<<<<<" and ">>>>>>" lines.
102.PP
103For example, suppose lines 7-8 are changed in both file1 and file2.
104Applying the edit script generated by the command
105.ce
106"diff3 -E file1 file2 file3"
107.br
108to file1 results in the file:
109.RS
110.nf
111
112lines 1-6
113of file1
114<<<<<<< file1
115lines 7-8
116of file1
117=======
118lines 7-8
119of file3
120>>>>>>> file3
121rest of file1
122.fi
123.RE
124.PP
125The
126.B \-E
127option is used by RCS
128.IR merge (1)
129to insure that overlapping changes in the merged files are preserved
130and brought to someone's attention.
eadf9268
KM
131.SH FILES
132/tmp/d3?????
133.br
134/usr/lib/diff3
135.SH "SEE ALSO"
136diff(1)
137.SH BUGS
138Text lines that consist of a single `.' will
139defeat
140.B \-e.