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