xref: /minix/usr.bin/sdiff/sdiff.1 (revision 0a6a1f1d)
1.\" $NetBSD: sdiff.1,v 1.4 2014/03/18 18:20:45 riastradh Exp $
2.\" $OpenBSD: sdiff.1,v 1.11 2007/02/22 02:50:56 ray Exp $
3.\"
4.\" Written by Raymond Lai <ray@cyth.net>.
5.\" Public domain.
6.\"
7.Dd February 21, 2007
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 abdilstW
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 | .
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
42Only print the left column for identical lines.
43.It Fl o 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
61Choose left set of diffs.
62.It Cm r
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
83Skip identical lines.
84.It Fl w 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
96Treat
97.Ar file1
98and
99.Ar file2
100as text files.
101.It Fl b
102Ignore trailing blank spaces.
103.It Fl d
104Minimize diff size.
105.It Fl I 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
112Do a case-insensitive comparison.
113.It Fl t
114Expand tabs to spaces.
115.It Fl W
116Ignore all spaces
117(the
118.Fl w
119flag is passed to
120.Xr diff 1 ) .
121.El
122.Sh ENVIRONMENT
123.Bl -tag -width Ds
124.It Ev EDITOR , VISUAL
125Specifies an editor to use with the
126.Fl o
127option.
128If both
129.Ev EDITOR
130and
131.Ev VISUAL
132are set,
133.Ev VISUAL
134takes precedence.
135If neither
136.Ev EDITOR
137nor
138.Ev VISUAL
139are set,
140the default is
141.Xr vi 1 .
142.It Ev TMPDIR
143Specifies a directory for temporary files to be created.
144The default is
145.Pa /tmp .
146.El
147.Sh SEE ALSO
148.Xr diff 1 ,
149.Xr diff3 1 ,
150.Xr vi 1 ,
151.Xr re_format 7
152.Sh AUTHORS
153.Nm
154was written from scratch for the public domain by
155.An Ray Lai Aq Mt ray@cyth.net .
156.Sh CAVEATS
157Although undocumented,
158.Nm
159supports all options supported by GNU sdiff.
160Some options require GNU diff.
161.Pp
162Tabs are treated as anywhere from one to eight characters wide,
163depending on the current column.
164Terminals that treat tabs as eight characters wide will look best.
165.Sh BUGS
166.Nm
167may not work with binary data.
168