xref: /openbsd/usr.bin/sdiff/sdiff.1 (revision e59e7544)
1*e59e7544Sray.\" $OpenBSD: sdiff.1,v 1.11 2007/02/22 02:50:56 ray Exp $
2228e906dStedu.\"
3228e906dStedu.\" Written by Raymond Lai <ray@cyth.net>.
4228e906dStedu.\" Public domain.
5228e906dStedu.\"
6*e59e7544Sray.Dd February 21, 2007
7228e906dStedu.Dt SDIFF 1
8228e906dStedu.Os
9228e906dStedu.Sh NAME
10228e906dStedu.Nm sdiff
11228e906dStedu.Nd side-by-side diff
12228e906dStedu.Sh SYNOPSIS
13228e906dStedu.Nm
14618b0722Stedu.Op Fl abdilstW
15228e906dStedu.Op Fl I Ar regexp
16228e906dStedu.Op Fl o Ar outfile
17228e906dStedu.Op Fl w Ar width
18228e906dStedu.Ar file1
19228e906dStedu.Ar file2
20228e906dStedu.Sh DESCRIPTION
21*e59e7544Sray.Nm
22*e59e7544Sraydisplays two files side by side,
23*e59e7544Sraywith any differences between the two highlighted as follows:
24*e59e7544Sraynew lines are marked with
25*e59e7544Sray.Sq \*(Gt ;
26*e59e7544Sraydeleted lines are marked with
27*e59e7544Sray.Sq \*(Lt ;
28*e59e7544Srayand changed lines are marked with
29*e59e7544Sray.Sq \*(Ba .
30*e59e7544Sray.Pp
31*e59e7544Sray.Nm
32*e59e7544Sraycan also be used to interactively merge two files,
33*e59e7544Srayprompting at each set of differences.
34*e59e7544SraySee the
35*e59e7544Sray.Fl o
36*e59e7544Srayoption for an explanation.
37228e906dStedu.Pp
38228e906dSteduThe options are:
39228e906dStedu.Bl -tag -width Ds
40228e906dStedu.It Fl l
416c5dcafeSjmcOnly print the left column for identical lines.
42228e906dStedu.It Fl o Ar outfile
43228e906dSteduInteractively merge
44228e906dStedu.Ar file1
45228e906dSteduand
46228e906dStedu.Ar file2
47228e906dSteduinto
48228e906dStedu.Ar outfile .
49228e906dSteduIn this mode, the user is prompted for each set of differences.
5050561fc4SjmcSee
5150561fc4Sjmc.Ev EDITOR
5250561fc4Sjmcand
5350561fc4Sjmc.Ev VISUAL ,
5450561fc4Sjmcbelow,
5550561fc4Sjmcfor details of which editor, if any, is invoked.
56228e906dStedu.Pp
576c5dcafeSjmcThe commands are as follows:
58228e906dStedu.Bl -tag -width Ds
59228e906dStedu.It Cm l
60228e906dSteduChoose left set of diffs.
61228e906dStedu.It Cm r
62228e906dSteduChoose right set of diffs.
63228e906dStedu.It Cm s
64228e906dSteduSilent mode \(en identical lines are not printed.
65228e906dStedu.It Cm v
66228e906dSteduVerbose mode \(en identical lines are printed.
67228e906dStedu.It Cm e
68228e906dSteduStart editing an empty file, which will be merged into
69228e906dStedu.Ar outfile
70228e906dSteduupon exiting the editor.
71228e906dStedu.It Cm e Cm l
72228e906dSteduStart editing file with left set of diffs.
73228e906dStedu.It Cm e Cm r
74228e906dSteduStart editing file with right set of diffs.
75228e906dStedu.It Cm e Cm b
76228e906dSteduStart editing file with both sets of diffs.
77228e906dStedu.It Cm q
78228e906dSteduQuit
79228e906dStedu.Nm .
80228e906dStedu.El
81228e906dStedu.It Fl s
82228e906dSteduSkip identical lines.
83228e906dStedu.It Fl w Ar width
84228e906dSteduPrint a maximum of
85228e906dStedu.Ar width
86228e906dSteducharacters on each line.
87228e906dSteduThe default is 130 characters.
88228e906dStedu.El
89228e906dStedu.Pp
90228e906dSteduOptions passed to
91228e906dStedu.Xr diff 1
92228e906dSteduare:
93228e906dStedu.Bl -tag -width Ds
94228e906dStedu.It Fl a
95228e906dSteduTreat
96228e906dStedu.Ar file1
97228e906dSteduand
98228e906dStedu.Ar file2
99228e906dSteduas text files.
100228e906dStedu.It Fl b
101228e906dSteduIgnore trailing blank spaces.
102228e906dStedu.It Fl d
103228e906dSteduMinimize diff size.
104228e906dStedu.It Fl I Ar regexp
105228e906dSteduIgnore line changes matching
106228e906dStedu.Ar regexp .
10782aa626aSjmcAll lines in the change must match
10882aa626aSjmc.Ar regexp
10982aa626aSjmcfor the change to be ignored.
110228e906dStedu.It Fl i
111228e906dSteduDo a case-insensitive comparison.
112228e906dStedu.It Fl t
113228e906dSteduExpand tabs to spaces.
114228e906dStedu.It Fl W
1156c5dcafeSjmcIgnore all spaces
1166c5dcafeSjmc(the
117228e906dStedu.Fl w
118228e906dSteduflag is passed to
1196c5dcafeSjmc.Xr diff 1 ) .
120228e906dStedu.El
12150561fc4Sjmc.Sh ENVIRONMENT
12250561fc4Sjmc.Bl -tag -width Ds
12350561fc4Sjmc.It Ev EDITOR , VISUAL
12450561fc4SjmcSpecifies an editor to use with the
12550561fc4Sjmc.Fl o
12650561fc4Sjmcoption.
12750561fc4SjmcIf both
12850561fc4Sjmc.Ev EDITOR
12950561fc4Sjmcand
13050561fc4Sjmc.Ev VISUAL
13150561fc4Sjmcare set,
13250561fc4Sjmc.Ev VISUAL
13350561fc4Sjmctakes precedence.
13450561fc4SjmcIf neither
13550561fc4Sjmc.Ev EDITOR
13650561fc4Sjmcnor
13750561fc4Sjmc.Ev VISUAL
13850561fc4Sjmcare set,
13950561fc4Sjmcthe default is
14050561fc4Sjmc.Xr vi 1 .
1419c3b0b15Sjmc.It Ev TMPDIR
1429c3b0b15SjmcSpecifies a directory for temporary files to be created.
1439c3b0b15SjmcThe default is
1449c3b0b15Sjmc.Pa /tmp .
14550561fc4Sjmc.El
146d7f7052aSjmc.Sh SEE ALSO
1476272b51eSjasper.Xr cmp 1 ,
148d7f7052aSjmc.Xr diff 1 ,
14950561fc4Sjmc.Xr diff3 1 ,
15082aa626aSjmc.Xr vi 1 ,
15182aa626aSjmc.Xr re_format 7
1526c5dcafeSjmc.Sh AUTHORS
1536c5dcafeSjmc.Nm
1546c5dcafeSjmcwas written from scratch for the public domain by
1556c5dcafeSjmc.An Ray Lai Aq ray@cyth.net .
156228e906dStedu.Sh CAVEATS
157228e906dSteduAlthough undocumented,
158228e906dStedu.Nm
159228e906dStedusupports all options supported by GNU sdiff.
160228e906dSteduSome options require GNU diff.
161228e906dStedu.Pp
162228e906dSteduTabs are treated as anywhere from one to eight characters wide,
163228e906dStedudepending on the current column.
164228e906dSteduTerminals that treat tabs as eight characters wide will look best.
1656b9f4b67Sray.Sh BUGS
1666b9f4b67Sray.Nm
1676b9f4b67Sraymay not work with binary data.
168