xref: /dflybsd-src/usr.bin/sdiff/sdiff.1 (revision c9733229451fac5faa53b1a016b01866eae75a1c)
1*c9733229SMatthew Dillon.\" $OpenBSD: sdiff.1,v 1.15 2007/06/29 14:48:07 jmc Exp $
2*c9733229SMatthew Dillon.\"
3*c9733229SMatthew Dillon.\" Written by Raymond Lai <ray@cyth.net>.
4*c9733229SMatthew Dillon.\" Public domain.
5*c9733229SMatthew Dillon.\"
6*c9733229SMatthew Dillon.Dd February 16, 2024
7*c9733229SMatthew Dillon.Dt SDIFF 1
8*c9733229SMatthew Dillon.Os
9*c9733229SMatthew Dillon.Sh NAME
10*c9733229SMatthew Dillon.Nm sdiff
11*c9733229SMatthew Dillon.Nd side-by-side diff
12*c9733229SMatthew Dillon.Sh SYNOPSIS
13*c9733229SMatthew Dillon.Nm
14*c9733229SMatthew Dillon.Op Fl abdilstHW
15*c9733229SMatthew Dillon.Op Fl I Ar regexp
16*c9733229SMatthew Dillon.Op Fl o Ar outfile
17*c9733229SMatthew Dillon.Op Fl w Ar width
18*c9733229SMatthew Dillon.Ar file1
19*c9733229SMatthew Dillon.Ar file2
20*c9733229SMatthew Dillon.Sh DESCRIPTION
21*c9733229SMatthew Dillon.Nm
22*c9733229SMatthew Dillondisplays two files side by side,
23*c9733229SMatthew Dillonwith any differences between the two highlighted as follows:
24*c9733229SMatthew Dillonnew lines are marked with
25*c9733229SMatthew Dillon.Sq \*(Gt ;
26*c9733229SMatthew Dillondeleted lines are marked with
27*c9733229SMatthew Dillon.Sq \*(Lt ;
28*c9733229SMatthew Dillonand changed lines are marked with
29*c9733229SMatthew Dillon.Sq \*(Ba .
30*c9733229SMatthew Dillon.Pp
31*c9733229SMatthew Dillon.Nm
32*c9733229SMatthew Dilloncan also be used to interactively merge two files,
33*c9733229SMatthew Dillonprompting at each set of differences.
34*c9733229SMatthew DillonSee the
35*c9733229SMatthew Dillon.Fl o
36*c9733229SMatthew Dillonoption for an explanation.
37*c9733229SMatthew Dillon.Pp
38*c9733229SMatthew DillonThe options are:
39*c9733229SMatthew Dillon.Bl -tag -width Ds
40*c9733229SMatthew Dillon.It Fl l -left-column
41*c9733229SMatthew DillonOnly print the left column for identical lines.
42*c9733229SMatthew Dillon.It Fl o -output Ar outfile
43*c9733229SMatthew DillonInteractively merge
44*c9733229SMatthew Dillon.Ar file1
45*c9733229SMatthew Dillonand
46*c9733229SMatthew Dillon.Ar file2
47*c9733229SMatthew Dilloninto
48*c9733229SMatthew Dillon.Ar outfile .
49*c9733229SMatthew DillonIn this mode, the user is prompted for each set of differences.
50*c9733229SMatthew DillonSee
51*c9733229SMatthew Dillon.Ev EDITOR
52*c9733229SMatthew Dillonand
53*c9733229SMatthew Dillon.Ev VISUAL ,
54*c9733229SMatthew Dillonbelow,
55*c9733229SMatthew Dillonfor details of which editor, if any, is invoked.
56*c9733229SMatthew Dillon.Pp
57*c9733229SMatthew DillonThe commands are as follows:
58*c9733229SMatthew Dillon.Bl -tag -width Ds
59*c9733229SMatthew Dillon.It Cm l | 1
60*c9733229SMatthew DillonChoose left set of diffs.
61*c9733229SMatthew Dillon.It Cm r | 2
62*c9733229SMatthew DillonChoose right set of diffs.
63*c9733229SMatthew Dillon.It Cm s
64*c9733229SMatthew DillonSilent mode \(en identical lines are not printed.
65*c9733229SMatthew Dillon.It Cm v
66*c9733229SMatthew DillonVerbose mode \(en identical lines are printed.
67*c9733229SMatthew Dillon.It Cm e
68*c9733229SMatthew DillonStart editing an empty file, which will be merged into
69*c9733229SMatthew Dillon.Ar outfile
70*c9733229SMatthew Dillonupon exiting the editor.
71*c9733229SMatthew Dillon.It Cm e Cm l
72*c9733229SMatthew DillonStart editing file with left set of diffs.
73*c9733229SMatthew Dillon.It Cm e Cm r
74*c9733229SMatthew DillonStart editing file with right set of diffs.
75*c9733229SMatthew Dillon.It Cm e Cm b
76*c9733229SMatthew DillonStart editing file with both sets of diffs.
77*c9733229SMatthew Dillon.It Cm q
78*c9733229SMatthew DillonQuit
79*c9733229SMatthew Dillon.Nm .
80*c9733229SMatthew Dillon.El
81*c9733229SMatthew Dillon.It Fl s -suppress-common-lines
82*c9733229SMatthew DillonSkip identical lines.
83*c9733229SMatthew Dillon.It Fl w -width Ar width
84*c9733229SMatthew DillonPrint a maximum of
85*c9733229SMatthew Dillon.Ar width
86*c9733229SMatthew Dilloncharacters on each line.
87*c9733229SMatthew DillonThe default is 130 characters.
88*c9733229SMatthew Dillon.El
89*c9733229SMatthew Dillon.Pp
90*c9733229SMatthew DillonOptions passed to
91*c9733229SMatthew Dillon.Xr diff 1
92*c9733229SMatthew Dillonare:
93*c9733229SMatthew Dillon.Bl -tag -width Ds
94*c9733229SMatthew Dillon.It Fl a -text
95*c9733229SMatthew DillonTreat
96*c9733229SMatthew Dillon.Ar file1
97*c9733229SMatthew Dillonand
98*c9733229SMatthew Dillon.Ar file2
99*c9733229SMatthew Dillonas text files.
100*c9733229SMatthew Dillon.It Fl b -ignore-space-change
101*c9733229SMatthew DillonIgnore trailing blank spaces.
102*c9733229SMatthew Dillon.It Fl d -minimal
103*c9733229SMatthew DillonMinimize diff size.
104*c9733229SMatthew Dillon.It Fl I -ignore-matching-lines Ar regexp
105*c9733229SMatthew DillonIgnore line changes matching
106*c9733229SMatthew Dillon.Ar regexp .
107*c9733229SMatthew DillonAll lines in the change must match
108*c9733229SMatthew Dillon.Ar regexp
109*c9733229SMatthew Dillonfor the change to be ignored.
110*c9733229SMatthew Dillon.It Fl i -ignore-case
111*c9733229SMatthew DillonDo a case-insensitive comparison.
112*c9733229SMatthew Dillon.It Fl t -expand-tabs
113*c9733229SMatthew DillonExpand tabs to spaces.
114*c9733229SMatthew Dillon.It Fl W -ignore-all-space
115*c9733229SMatthew DillonIgnore all spaces.
116*c9733229SMatthew Dillon.It Fl B -ignore-blank-lines
117*c9733229SMatthew DillonIgnore blank lines.
118*c9733229SMatthew Dillon.It Fl E -ignore-tab-expansion
119*c9733229SMatthew DillonTreat tabs and eight spaces as the same.
120*c9733229SMatthew Dillon.It Fl H -speed-large-files
121*c9733229SMatthew DillonAssume scattered small changes in a large file.
122*c9733229SMatthew Dillon.It Fl -ignore-file-name-case
123*c9733229SMatthew DillonIgnore the case of file names.
124*c9733229SMatthew Dillon.It Fl -no-ignore-file-name-case
125*c9733229SMatthew DillonDo not ignore file name case.
126*c9733229SMatthew Dillon.It Fl -strip-trailing-cr
127*c9733229SMatthew DillonSkip identical lines.
128*c9733229SMatthew Dillon.It Fl -tabsize Ar NUM
129*c9733229SMatthew DillonChange the size of tabs (default is 8.)
130*c9733229SMatthew Dillon.El
131*c9733229SMatthew Dillon.Sh ENVIRONMENT
132*c9733229SMatthew Dillon.Bl -tag -width Ds
133*c9733229SMatthew Dillon.It Ev EDITOR , VISUAL
134*c9733229SMatthew DillonSpecifies an editor to use with the
135*c9733229SMatthew Dillon.Fl o
136*c9733229SMatthew Dillonoption.
137*c9733229SMatthew DillonIf both
138*c9733229SMatthew Dillon.Ev EDITOR
139*c9733229SMatthew Dillonand
140*c9733229SMatthew Dillon.Ev VISUAL
141*c9733229SMatthew Dillonare set,
142*c9733229SMatthew Dillon.Ev VISUAL
143*c9733229SMatthew Dillontakes precedence.
144*c9733229SMatthew DillonIf neither
145*c9733229SMatthew Dillon.Ev EDITOR
146*c9733229SMatthew Dillonnor
147*c9733229SMatthew Dillon.Ev VISUAL
148*c9733229SMatthew Dillonare set,
149*c9733229SMatthew Dillonthe default is
150*c9733229SMatthew Dillon.Xr vi 1 .
151*c9733229SMatthew Dillon.It Ev TMPDIR
152*c9733229SMatthew DillonSpecifies a directory for temporary files to be created.
153*c9733229SMatthew DillonThe default is
154*c9733229SMatthew Dillon.Pa /tmp .
155*c9733229SMatthew Dillon.El
156*c9733229SMatthew Dillon.Sh SEE ALSO
157*c9733229SMatthew Dillon.Xr cmp 1 ,
158*c9733229SMatthew Dillon.Xr diff 1 ,
159*c9733229SMatthew Dillon.Xr diff3 1 ,
160*c9733229SMatthew Dillon.Xr vi 1 ,
161*c9733229SMatthew Dillon.Xr re_format 7
162*c9733229SMatthew Dillon.Sh AUTHORS
163*c9733229SMatthew Dillon.Nm
164*c9733229SMatthew Dillonwas written from scratch for the public domain by
165*c9733229SMatthew Dillon.An Ray Lai Aq ray@cyth.net .
166*c9733229SMatthew Dillon.Sh CAVEATS
167*c9733229SMatthew DillonTabs are treated as anywhere from one to eight characters wide,
168*c9733229SMatthew Dillondepending on the current column.
169*c9733229SMatthew DillonTerminals that treat tabs as eight characters wide will look best.
170