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