xref: /dflybsd-src/usr.bin/diff/diff.1 (revision c9733229451fac5faa53b1a016b01866eae75a1c)
1*c9733229SMatthew Dillon.\" $OpenBSD: diff.1,v 1.51 2023/01/05 00:00:44 millert Exp $
2*c9733229SMatthew Dillon.\"
3*c9733229SMatthew Dillon.\" Copyright (c) 1980, 1990, 1993
4*c9733229SMatthew Dillon.\"	The Regents of the University of California.  All rights reserved.
5*c9733229SMatthew Dillon.\"
6*c9733229SMatthew Dillon.\" Redistribution and use in source and binary forms, with or without
7*c9733229SMatthew Dillon.\" modification, are permitted provided that the following conditions
8*c9733229SMatthew Dillon.\" are met:
9*c9733229SMatthew Dillon.\" 1. Redistributions of source code must retain the above copyright
10*c9733229SMatthew Dillon.\"    notice, this list of conditions and the following disclaimer.
11*c9733229SMatthew Dillon.\" 2. Redistributions in binary form must reproduce the above copyright
12*c9733229SMatthew Dillon.\"    notice, this list of conditions and the following disclaimer in the
13*c9733229SMatthew Dillon.\"    documentation and/or other materials provided with the distribution.
14*c9733229SMatthew Dillon.\" 3. Neither the name of the University nor the names of its contributors
15*c9733229SMatthew Dillon.\"    may be used to endorse or promote products derived from this software
16*c9733229SMatthew Dillon.\"    without specific prior written permission.
17*c9733229SMatthew Dillon.\"
18*c9733229SMatthew Dillon.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19*c9733229SMatthew Dillon.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20*c9733229SMatthew Dillon.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21*c9733229SMatthew Dillon.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22*c9733229SMatthew Dillon.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23*c9733229SMatthew Dillon.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24*c9733229SMatthew Dillon.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25*c9733229SMatthew Dillon.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26*c9733229SMatthew Dillon.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27*c9733229SMatthew Dillon.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28*c9733229SMatthew Dillon.\" SUCH DAMAGE.
29*c9733229SMatthew Dillon.\"
30*c9733229SMatthew Dillon.\"     @(#)diff.1	8.1 (Berkeley) 6/30/93
31*c9733229SMatthew Dillon.\"
32*c9733229SMatthew Dillon.Dd $Mdocdate: January 5 2023 $
33*c9733229SMatthew Dillon.Dt DIFF 1
34*c9733229SMatthew Dillon.Os
35*c9733229SMatthew Dillon.Sh NAME
36*c9733229SMatthew Dillon.Nm diff
37*c9733229SMatthew Dillon.Nd differential file and directory comparator
38*c9733229SMatthew Dillon.Sh SYNOPSIS
39*c9733229SMatthew Dillon.Nm diff
40*c9733229SMatthew Dillon.Op Fl abdipTtw
41*c9733229SMatthew Dillon.Oo
42*c9733229SMatthew Dillon.Fl c | e | f |
43*c9733229SMatthew Dillon.Fl n | q | u
44*c9733229SMatthew Dillon.Oc
45*c9733229SMatthew Dillon.Op Fl I Ar pattern
46*c9733229SMatthew Dillon.Op Fl L Ar label
47*c9733229SMatthew Dillon.Ar file1 file2
48*c9733229SMatthew Dillon.Nm diff
49*c9733229SMatthew Dillon.Op Fl abdipTtw
50*c9733229SMatthew Dillon.Op Fl I Ar pattern
51*c9733229SMatthew Dillon.Op Fl L Ar label
52*c9733229SMatthew Dillon.Fl C Ar number
53*c9733229SMatthew Dillon.Ar file1 file2
54*c9733229SMatthew Dillon.Nm diff
55*c9733229SMatthew Dillon.Op Fl abditw
56*c9733229SMatthew Dillon.Op Fl I Ar pattern
57*c9733229SMatthew Dillon.Fl D Ar string
58*c9733229SMatthew Dillon.Ar file1 file2
59*c9733229SMatthew Dillon.Nm diff
60*c9733229SMatthew Dillon.Op Fl abdipTtw
61*c9733229SMatthew Dillon.Op Fl I Ar pattern
62*c9733229SMatthew Dillon.Op Fl L Ar label
63*c9733229SMatthew Dillon.Fl U Ar number
64*c9733229SMatthew Dillon.Ar file1 file2
65*c9733229SMatthew Dillon.Nm diff
66*c9733229SMatthew Dillon.Op Fl abdiNPprsTtw
67*c9733229SMatthew Dillon.Oo
68*c9733229SMatthew Dillon.Fl c | e | f |
69*c9733229SMatthew Dillon.Fl n | q | u
70*c9733229SMatthew Dillon.Oc
71*c9733229SMatthew Dillon.Op Fl I Ar pattern
72*c9733229SMatthew Dillon.Bk -words
73*c9733229SMatthew Dillon.Op Fl L Ar label
74*c9733229SMatthew Dillon.Op Fl S Ar name
75*c9733229SMatthew Dillon.Op Fl X Ar file
76*c9733229SMatthew Dillon.Op Fl x Ar pattern
77*c9733229SMatthew Dillon.Ek
78*c9733229SMatthew Dillon.Ar dir1 dir2
79*c9733229SMatthew Dillon.Sh DESCRIPTION
80*c9733229SMatthew DillonThe
81*c9733229SMatthew Dillon.Nm
82*c9733229SMatthew Dillonutility compares the contents of
83*c9733229SMatthew Dillon.Ar file1
84*c9733229SMatthew Dillonand
85*c9733229SMatthew Dillon.Ar file2
86*c9733229SMatthew Dillonand writes to the standard output the list of changes necessary to
87*c9733229SMatthew Dillonconvert one file into the other.
88*c9733229SMatthew DillonNo output is produced if the files are identical.
89*c9733229SMatthew Dillon.Pp
90*c9733229SMatthew DillonOutput options (mutually exclusive):
91*c9733229SMatthew Dillon.Bl -tag -width Ds
92*c9733229SMatthew Dillon.It Fl C Ar number
93*c9733229SMatthew DillonLike
94*c9733229SMatthew Dillon.Fl c
95*c9733229SMatthew Dillonbut produces a diff with
96*c9733229SMatthew Dillon.Ar number
97*c9733229SMatthew Dillonlines of context.
98*c9733229SMatthew Dillon.It Fl c
99*c9733229SMatthew DillonProduces a diff with 3 lines of context.
100*c9733229SMatthew DillonWith
101*c9733229SMatthew Dillon.Fl c
102*c9733229SMatthew Dillonthe output format is modified slightly:
103*c9733229SMatthew Dillonthe output begins with identification of the files involved and
104*c9733229SMatthew Dillontheir creation dates and then each change is separated
105*c9733229SMatthew Dillonby a line with fifteen
106*c9733229SMatthew Dillon.Li * Ns 's .
107*c9733229SMatthew DillonThe lines removed from
108*c9733229SMatthew Dillon.Ar file1
109*c9733229SMatthew Dillonare marked with
110*c9733229SMatthew Dillon.Sq \-\ \& ;
111*c9733229SMatthew Dillonthose added to
112*c9733229SMatthew Dillon.Ar file2
113*c9733229SMatthew Dillonare marked
114*c9733229SMatthew Dillon.Sq +\ \& .
115*c9733229SMatthew DillonLines which are changed from one file to the other are marked in
116*c9733229SMatthew Dillonboth files with
117*c9733229SMatthew Dillon.Sq !\ \& .
118*c9733229SMatthew DillonChanges which lie within 3 lines of each other are grouped together on
119*c9733229SMatthew Dillonoutput.
120*c9733229SMatthew Dillon.It Fl D Ar string
121*c9733229SMatthew DillonCreates a merged version of
122*c9733229SMatthew Dillon.Ar file1
123*c9733229SMatthew Dillonand
124*c9733229SMatthew Dillon.Ar file2
125*c9733229SMatthew Dillonon the standard output, with C preprocessor controls included so that
126*c9733229SMatthew Dillona compilation of the result without defining
127*c9733229SMatthew Dillon.Ar string
128*c9733229SMatthew Dillonis equivalent to compiling
129*c9733229SMatthew Dillon.Ar file1 ,
130*c9733229SMatthew Dillonwhile defining
131*c9733229SMatthew Dillon.Ar string
132*c9733229SMatthew Dillonwill yield
133*c9733229SMatthew Dillon.Ar file2 .
134*c9733229SMatthew Dillon.It Fl e
135*c9733229SMatthew DillonProduces output in a form suitable as input for the editor utility,
136*c9733229SMatthew Dillon.Xr ed 1 ,
137*c9733229SMatthew Dillonwhich can then be used to convert file1 into file2.
138*c9733229SMatthew Dillon.Pp
139*c9733229SMatthew DillonExtra commands are added to the output when comparing directories with
140*c9733229SMatthew Dillon.Fl e ,
141*c9733229SMatthew Dillonso that the result is a
142*c9733229SMatthew Dillon.Xr sh 1
143*c9733229SMatthew Dillonscript for converting text files which are common to the two directories
144*c9733229SMatthew Dillonfrom their state in
145*c9733229SMatthew Dillon.Ar dir1
146*c9733229SMatthew Dillonto their state in
147*c9733229SMatthew Dillon.Ar dir2 .
148*c9733229SMatthew Dillon.It Fl f
149*c9733229SMatthew DillonIdentical output to that of the
150*c9733229SMatthew Dillon.Fl e
151*c9733229SMatthew Dillonflag, but in reverse order.
152*c9733229SMatthew DillonIt cannot be digested by
153*c9733229SMatthew Dillon.Xr ed 1 .
154*c9733229SMatthew Dillon.It Fl n
155*c9733229SMatthew DillonProduces a script similar to that of
156*c9733229SMatthew Dillon.Fl e ,
157*c9733229SMatthew Dillonbut in the opposite order and with a count of changed lines on each
158*c9733229SMatthew Dilloninsert or delete command.
159*c9733229SMatthew DillonThis is the form used by
160*c9733229SMatthew Dillon.Xr rcsdiff 1 .
161*c9733229SMatthew Dillon.It Fl q
162*c9733229SMatthew DillonJust print a line when the files differ.
163*c9733229SMatthew DillonDoes not output a list of changes.
164*c9733229SMatthew Dillon.It Fl U Ar number
165*c9733229SMatthew DillonLike
166*c9733229SMatthew Dillon.Fl u
167*c9733229SMatthew Dillonbut produces a diff with
168*c9733229SMatthew Dillon.Ar number
169*c9733229SMatthew Dillonlines of context.
170*c9733229SMatthew Dillon.It Fl u
171*c9733229SMatthew DillonProduces a
172*c9733229SMatthew Dillon.Em unified
173*c9733229SMatthew Dillondiff with 3 lines of context.
174*c9733229SMatthew DillonA unified diff is similar to the context diff produced by the
175*c9733229SMatthew Dillon.Fl c
176*c9733229SMatthew Dillonoption.
177*c9733229SMatthew DillonHowever, unlike with
178*c9733229SMatthew Dillon.Fl c ,
179*c9733229SMatthew Dillonall lines to be changed (added and/or removed) are present in
180*c9733229SMatthew Dillona single section.
181*c9733229SMatthew Dillon.El
182*c9733229SMatthew Dillon.Pp
183*c9733229SMatthew DillonComparison options:
184*c9733229SMatthew Dillon.Bl -tag -width Ds
185*c9733229SMatthew Dillon.It Fl a
186*c9733229SMatthew DillonTreat all files as ASCII text.
187*c9733229SMatthew DillonNormally
188*c9733229SMatthew Dillon.Nm
189*c9733229SMatthew Dillonwill simply print
190*c9733229SMatthew Dillon.Dq Binary files ... differ
191*c9733229SMatthew Dillonif files contain binary characters.
192*c9733229SMatthew DillonUse of this option forces
193*c9733229SMatthew Dillon.Nm
194*c9733229SMatthew Dillonto produce a diff.
195*c9733229SMatthew Dillon.It Fl b
196*c9733229SMatthew DillonCauses trailing blanks (spaces and tabs) to be ignored, and other
197*c9733229SMatthew Dillonstrings of blanks to compare equal.
198*c9733229SMatthew Dillon.It Fl d
199*c9733229SMatthew DillonTry very hard to produce a diff as small as possible.
200*c9733229SMatthew DillonThis may consume a lot of processing power and memory when processing
201*c9733229SMatthew Dillonlarge files with many changes.
202*c9733229SMatthew Dillon.It Fl I Ar pattern
203*c9733229SMatthew DillonIgnores changes, insertions, and deletions whose lines match the
204*c9733229SMatthew Dillonextended regular expression
205*c9733229SMatthew Dillon.Ar pattern .
206*c9733229SMatthew DillonMultiple
207*c9733229SMatthew Dillon.Fl I
208*c9733229SMatthew Dillonpatterns may be specified.
209*c9733229SMatthew DillonAll lines in the change must match some pattern for the change to be
210*c9733229SMatthew Dillonignored.
211*c9733229SMatthew DillonSee
212*c9733229SMatthew Dillon.Xr re_format 7
213*c9733229SMatthew Dillonfor more information on regular expression patterns.
214*c9733229SMatthew Dillon.It Fl i
215*c9733229SMatthew DillonIgnores the case of letters.
216*c9733229SMatthew DillonE.g.,
217*c9733229SMatthew Dillon.Dq A
218*c9733229SMatthew Dillonwill compare equal to
219*c9733229SMatthew Dillon.Dq a .
220*c9733229SMatthew Dillon.It Fl L Ar label
221*c9733229SMatthew DillonPrint
222*c9733229SMatthew Dillon.Ar label
223*c9733229SMatthew Dilloninstead of the first (and second, if this option is specified twice)
224*c9733229SMatthew Dillonfile name and time in the context or unified diff header.
225*c9733229SMatthew Dillon.It Fl p
226*c9733229SMatthew DillonWith unified and context diffs, show with each change
227*c9733229SMatthew Dillonthe first 40 characters of the last line before the context beginning
228*c9733229SMatthew Dillonwith a letter, an underscore or a dollar sign.
229*c9733229SMatthew DillonFor C source code following standard layout conventions, this will
230*c9733229SMatthew Dillonshow the prototype of the function the change applies to.
231*c9733229SMatthew Dillon.It Fl T
232*c9733229SMatthew DillonPrint a tab rather than a space before the rest of the line for the
233*c9733229SMatthew Dillonnormal, context or unified output formats.
234*c9733229SMatthew DillonThis makes the alignment of tabs in the line consistent.
235*c9733229SMatthew Dillon.It Fl t
236*c9733229SMatthew DillonWill expand tabs in output lines.
237*c9733229SMatthew DillonNormal or
238*c9733229SMatthew Dillon.Fl c
239*c9733229SMatthew Dillonoutput adds character(s) to the front of each line which may screw up
240*c9733229SMatthew Dillonthe indentation of the original source lines and make the output listing
241*c9733229SMatthew Dillondifficult to interpret.
242*c9733229SMatthew DillonThis option will preserve the original source's indentation.
243*c9733229SMatthew Dillon.It Fl w
244*c9733229SMatthew DillonIs similar to
245*c9733229SMatthew Dillon.Fl b
246*c9733229SMatthew Dillonbut causes whitespace (blanks and tabs) to be totally ignored.
247*c9733229SMatthew DillonE.g.,
248*c9733229SMatthew Dillon.Dq if (\ \&a == b \&)
249*c9733229SMatthew Dillonwill compare equal to
250*c9733229SMatthew Dillon.Dq if(a==b) .
251*c9733229SMatthew Dillon.El
252*c9733229SMatthew Dillon.Pp
253*c9733229SMatthew DillonDirectory comparison options:
254*c9733229SMatthew Dillon.Bl -tag -width Ds
255*c9733229SMatthew Dillon.It Fl N
256*c9733229SMatthew DillonIf a file is found in only one directory, act as if it was found in the
257*c9733229SMatthew Dillonother directory too but was of zero size.
258*c9733229SMatthew Dillon.It Fl P
259*c9733229SMatthew DillonIf a file is found only in
260*c9733229SMatthew Dillon.Ar dir2 ,
261*c9733229SMatthew Dillonact as if it was found in
262*c9733229SMatthew Dillon.Ar dir1
263*c9733229SMatthew Dillontoo but was of zero size.
264*c9733229SMatthew Dillon.It Fl r
265*c9733229SMatthew DillonCauses application of
266*c9733229SMatthew Dillon.Nm
267*c9733229SMatthew Dillonrecursively to common subdirectories encountered.
268*c9733229SMatthew Dillon.It Fl S Ar name
269*c9733229SMatthew DillonRe-starts a directory
270*c9733229SMatthew Dillon.Nm
271*c9733229SMatthew Dillonin the middle, beginning with file
272*c9733229SMatthew Dillon.Ar name .
273*c9733229SMatthew Dillon.It Fl s
274*c9733229SMatthew DillonCauses
275*c9733229SMatthew Dillon.Nm
276*c9733229SMatthew Dillonto report files which are the same, which are otherwise not mentioned.
277*c9733229SMatthew Dillon.It Fl X Ar file
278*c9733229SMatthew DillonExclude files and subdirectories from comparison whose basenames match
279*c9733229SMatthew Dillonlines in
280*c9733229SMatthew Dillon.Ar file .
281*c9733229SMatthew DillonMultiple
282*c9733229SMatthew Dillon.Fl X
283*c9733229SMatthew Dillonoptions may be specified.
284*c9733229SMatthew Dillon.It Fl x Ar pattern
285*c9733229SMatthew DillonExclude files and subdirectories from comparison whose basenames match
286*c9733229SMatthew Dillon.Ar pattern .
287*c9733229SMatthew DillonPatterns are matched using shell-style globbing via
288*c9733229SMatthew Dillon.Xr fnmatch 3 .
289*c9733229SMatthew DillonMultiple
290*c9733229SMatthew Dillon.Fl x
291*c9733229SMatthew Dillonoptions may be specified.
292*c9733229SMatthew Dillon.El
293*c9733229SMatthew Dillon.Pp
294*c9733229SMatthew DillonIf both arguments are directories,
295*c9733229SMatthew Dillon.Nm
296*c9733229SMatthew Dillonsorts the contents of the directories by name, and then runs the
297*c9733229SMatthew Dillonregular file
298*c9733229SMatthew Dillon.Nm
299*c9733229SMatthew Dillonalgorithm, producing a change list,
300*c9733229SMatthew Dillonon text files which are different.
301*c9733229SMatthew DillonBinary files which differ,
302*c9733229SMatthew Dilloncommon subdirectories, and files which appear in only one directory
303*c9733229SMatthew Dillonare described as such.
304*c9733229SMatthew DillonIn directory mode only regular files and directories are compared.
305*c9733229SMatthew DillonIf a non-regular file such as a device special file or FIFO
306*c9733229SMatthew Dillonis encountered, a diagnostic message is printed.
307*c9733229SMatthew Dillon.Pp
308*c9733229SMatthew DillonIf only one of
309*c9733229SMatthew Dillon.Ar file1
310*c9733229SMatthew Dillonand
311*c9733229SMatthew Dillon.Ar file2
312*c9733229SMatthew Dillonis a directory,
313*c9733229SMatthew Dillon.Nm
314*c9733229SMatthew Dillonis applied to the non-directory file and the file contained in
315*c9733229SMatthew Dillonthe directory file with a filename that is the same as the
316*c9733229SMatthew Dillonlast component of the non-directory file.
317*c9733229SMatthew Dillon.Pp
318*c9733229SMatthew DillonIf either
319*c9733229SMatthew Dillon.Ar file1
320*c9733229SMatthew Dillonor
321*c9733229SMatthew Dillon.Ar file2
322*c9733229SMatthew Dillonis
323*c9733229SMatthew Dillon.Sq - ,
324*c9733229SMatthew Dillonthe standard input is
325*c9733229SMatthew Dillonused in its place.
326*c9733229SMatthew Dillon.Ss Output Style
327*c9733229SMatthew DillonThe default (without
328*c9733229SMatthew Dillon.Fl e ,
329*c9733229SMatthew Dillon.Fl c ,
330*c9733229SMatthew Dillonor
331*c9733229SMatthew Dillon.Fl n
332*c9733229SMatthew Dillon.\" -C
333*c9733229SMatthew Dillonoptions)
334*c9733229SMatthew Dillonoutput contains lines of these forms, where
335*c9733229SMatthew Dillon.Va XX , YY , ZZ , QQ
336*c9733229SMatthew Dillonare line numbers respective of file order.
337*c9733229SMatthew Dillon.Pp
338*c9733229SMatthew Dillon.Bl -tag -width "XX,YYcZZ,QQ" -compact
339*c9733229SMatthew Dillon.It Li XX Ns Ic a Ns Li YY
340*c9733229SMatthew DillonAt (the end of) line
341*c9733229SMatthew Dillon.Va XX
342*c9733229SMatthew Dillonof
343*c9733229SMatthew Dillon.Ar file1 ,
344*c9733229SMatthew Dillonappend the contents
345*c9733229SMatthew Dillonof line
346*c9733229SMatthew Dillon.Va YY
347*c9733229SMatthew Dillonof
348*c9733229SMatthew Dillon.Ar file2
349*c9733229SMatthew Dillonto make them equal.
350*c9733229SMatthew Dillon.It Li XX Ns Ic a Ns Li YY,ZZ
351*c9733229SMatthew DillonSame as above, but append the range of lines,
352*c9733229SMatthew Dillon.Va YY
353*c9733229SMatthew Dillonthrough
354*c9733229SMatthew Dillon.Va ZZ
355*c9733229SMatthew Dillonof
356*c9733229SMatthew Dillon.Ar file2
357*c9733229SMatthew Dillonto line
358*c9733229SMatthew Dillon.Va XX
359*c9733229SMatthew Dillonof file1.
360*c9733229SMatthew Dillon.It Li XX Ns Ic d Ns Li YY
361*c9733229SMatthew DillonAt line
362*c9733229SMatthew Dillon.Va XX
363*c9733229SMatthew Dillondelete
364*c9733229SMatthew Dillonthe line.
365*c9733229SMatthew DillonThe value
366*c9733229SMatthew Dillon.Va YY
367*c9733229SMatthew Dillontells to which line the change would bring
368*c9733229SMatthew Dillon.Ar file1
369*c9733229SMatthew Dillonin line with
370*c9733229SMatthew Dillon.Ar file2 .
371*c9733229SMatthew Dillon.It Li XX,YY Ns Ic d Ns Li ZZ
372*c9733229SMatthew DillonDelete the range of lines
373*c9733229SMatthew Dillon.Va XX
374*c9733229SMatthew Dillonthrough
375*c9733229SMatthew Dillon.Va YY
376*c9733229SMatthew Dillonin
377*c9733229SMatthew Dillon.Ar file1 .
378*c9733229SMatthew Dillon.It Li XX Ns Ic c Ns Li YY
379*c9733229SMatthew DillonChange the line
380*c9733229SMatthew Dillon.Va XX
381*c9733229SMatthew Dillonin
382*c9733229SMatthew Dillon.Ar file1
383*c9733229SMatthew Dillonto the line
384*c9733229SMatthew Dillon.Va YY
385*c9733229SMatthew Dillonin
386*c9733229SMatthew Dillon.Ar file2 .
387*c9733229SMatthew Dillon.It Li XX,YY Ns Ic c Ns Li ZZ
388*c9733229SMatthew DillonReplace the range of specified lines with the line
389*c9733229SMatthew Dillon.Va ZZ .
390*c9733229SMatthew Dillon.It Li XX,YY Ns Ic c Ns Li ZZ,QQ
391*c9733229SMatthew DillonReplace the range
392*c9733229SMatthew Dillon.Va XX , Ns Va YY
393*c9733229SMatthew Dillonfrom
394*c9733229SMatthew Dillon.Ar file1
395*c9733229SMatthew Dillonwith the range
396*c9733229SMatthew Dillon.Va ZZ , Ns Va QQ
397*c9733229SMatthew Dillonfrom
398*c9733229SMatthew Dillon.Ar file2 .
399*c9733229SMatthew Dillon.El
400*c9733229SMatthew Dillon.Pp
401*c9733229SMatthew DillonThese lines resemble
402*c9733229SMatthew Dillon.Xr ed 1
403*c9733229SMatthew Dillonsubcommands to convert
404*c9733229SMatthew Dillon.Ar file1
405*c9733229SMatthew Dilloninto
406*c9733229SMatthew Dillon.Ar file2 .
407*c9733229SMatthew DillonThe line numbers before the action letters pertain to
408*c9733229SMatthew Dillon.Ar file1 ;
409*c9733229SMatthew Dillonthose after pertain to
410*c9733229SMatthew Dillon.Ar file2 .
411*c9733229SMatthew DillonThus, by exchanging
412*c9733229SMatthew Dillon.Ic a
413*c9733229SMatthew Dillonfor
414*c9733229SMatthew Dillon.Ic d
415*c9733229SMatthew Dillonand reading the line in reverse order, one can also
416*c9733229SMatthew Dillondetermine how to convert
417*c9733229SMatthew Dillon.Ar file2
418*c9733229SMatthew Dilloninto
419*c9733229SMatthew Dillon.Ar file1 .
420*c9733229SMatthew DillonAs in
421*c9733229SMatthew Dillon.Xr ed 1 ,
422*c9733229SMatthew Dillonidentical
423*c9733229SMatthew Dillonpairs (where num1 = num2) are abbreviated as a single
424*c9733229SMatthew Dillonnumber.
425*c9733229SMatthew Dillon.Sh FILES
426*c9733229SMatthew Dillon.Bl -tag -width /tmp/diff.XXXXXXXX -compact
427*c9733229SMatthew Dillon.It Pa /tmp/diff. Ns Ar XXXXXXXX
428*c9733229SMatthew DillonTemporary file used when comparing a device or the standard input.
429*c9733229SMatthew DillonNote that the temporary file is unlinked as soon as it is created
430*c9733229SMatthew Dillonso it will not show up in a directory listing.
431*c9733229SMatthew Dillon.El
432*c9733229SMatthew Dillon.Sh EXIT STATUS
433*c9733229SMatthew DillonThe
434*c9733229SMatthew Dillon.Nm
435*c9733229SMatthew Dillonutility exits with one of the following values:
436*c9733229SMatthew Dillon.Pp
437*c9733229SMatthew Dillon.Bl -tag -width Ds -offset indent -compact
438*c9733229SMatthew Dillon.It 0
439*c9733229SMatthew DillonNo differences were found.
440*c9733229SMatthew Dillon.It 1
441*c9733229SMatthew DillonDifferences were found.
442*c9733229SMatthew Dillon.It >1
443*c9733229SMatthew DillonAn error occurred.
444*c9733229SMatthew Dillon.El
445*c9733229SMatthew Dillon.Sh SEE ALSO
446*c9733229SMatthew Dillon.Xr cmp 1 ,
447*c9733229SMatthew Dillon.Xr comm 1 ,
448*c9733229SMatthew Dillon.Xr diff3 1 ,
449*c9733229SMatthew Dillon.Xr ed 1 ,
450*c9733229SMatthew Dillon.Xr patch 1 ,
451*c9733229SMatthew Dillon.Xr sdiff 1
452*c9733229SMatthew Dillon.Rs
453*c9733229SMatthew Dillon.%A James W. Hunt
454*c9733229SMatthew Dillon.%A M. Douglas McIlroy
455*c9733229SMatthew Dillon.%T "An Algorithm for Differential File Comparison"
456*c9733229SMatthew Dillon.%I AT&T Bell Laboratories
457*c9733229SMatthew Dillon.%J Computing Science Technical Report
458*c9733229SMatthew Dillon.%N 41
459*c9733229SMatthew Dillon.%D June 1976
460*c9733229SMatthew Dillon.Re
461*c9733229SMatthew Dillon.Sh STANDARDS
462*c9733229SMatthew DillonThe
463*c9733229SMatthew Dillon.Nm
464*c9733229SMatthew Dillonutility is compliant with the
465*c9733229SMatthew Dillon.St -p1003.1-2008
466*c9733229SMatthew Dillonspecification.
467*c9733229SMatthew Dillon.Pp
468*c9733229SMatthew DillonThe flags
469*c9733229SMatthew Dillon.Op Fl aDdIiLNnPpqSsTtwXx
470*c9733229SMatthew Dillonare extensions to that specification.
471*c9733229SMatthew Dillon.Sh HISTORY
472*c9733229SMatthew DillonA
473*c9733229SMatthew Dillon.Nm
474*c9733229SMatthew Dilloncommand appeared in
475*c9733229SMatthew Dillon.At v5 .
476