$OpenBSD: sdiff.1,v 1.15 2007/06/29 14:48:07 jmc Exp $

Written by Raymond Lai <ray@cyth.net>.
Public domain.

.Dd February 16, 2024 .Dt SDIFF 1 .Os .Sh NAME .Nm sdiff .Nd side-by-side diff .Sh SYNOPSIS .Nm .Op Fl abdilstHW .Op Fl I Ar regexp .Op Fl o Ar outfile .Op Fl w Ar width .Ar file1 .Ar file2 .Sh DESCRIPTION .Nm displays two files side by side, with any differences between the two highlighted as follows: new lines are marked with .Sq \*(Gt ; deleted lines are marked with .Sq \*(Lt ; and changed lines are marked with .Sq \*(Ba .

p .Nm can also be used to interactively merge two files, prompting at each set of differences. See the .Fl o option for an explanation.

p The options are: l -tag -width Ds t Fl l -left-column Only print the left column for identical lines. t Fl o -output Ar outfile Interactively merge .Ar file1 and .Ar file2 into .Ar outfile . In this mode, the user is prompted for each set of differences. See .Ev EDITOR and .Ev VISUAL , below, for details of which editor, if any, is invoked.

p The commands are as follows: l -tag -width Ds t Cm l | 1 Choose left set of diffs. t Cm r | 2 Choose right set of diffs. t Cm s Silent mode \(en identical lines are not printed. t Cm v Verbose mode \(en identical lines are printed. t Cm e Start editing an empty file, which will be merged into .Ar outfile upon exiting the editor. t Cm e Cm l Start editing file with left set of diffs. t Cm e Cm r Start editing file with right set of diffs. t Cm e Cm b Start editing file with both sets of diffs. t Cm q Quit .Nm . .El t Fl s -suppress-common-lines Skip identical lines. t Fl w -width Ar width Print a maximum of .Ar width characters on each line. The default is 130 characters. .El

p Options passed to .Xr diff 1 are: l -tag -width Ds t Fl a -text Treat .Ar file1 and .Ar file2 as text files. t Fl b -ignore-space-change Ignore trailing blank spaces. t Fl d -minimal Minimize diff size. t Fl I -ignore-matching-lines Ar regexp Ignore line changes matching .Ar regexp . All lines in the change must match .Ar regexp for the change to be ignored. t Fl i -ignore-case Do a case-insensitive comparison. t Fl t -expand-tabs Expand tabs to spaces. t Fl W -ignore-all-space Ignore all spaces. t Fl B -ignore-blank-lines Ignore blank lines. t Fl E -ignore-tab-expansion Treat tabs and eight spaces as the same. t Fl H -speed-large-files Assume scattered small changes in a large file. t Fl -ignore-file-name-case Ignore the case of file names. t Fl -no-ignore-file-name-case Do not ignore file name case. t Fl -strip-trailing-cr Skip identical lines. t Fl -tabsize Ar NUM Change the size of tabs (default is 8.) .El .Sh ENVIRONMENT l -tag -width Ds t Ev EDITOR , VISUAL Specifies an editor to use with the .Fl o option. If both .Ev EDITOR and .Ev VISUAL are set, .Ev VISUAL takes precedence. If neither .Ev EDITOR nor .Ev VISUAL are set, the default is .Xr vi 1 . t Ev TMPDIR Specifies a directory for temporary files to be created. The default is

a /tmp . .El .Sh SEE ALSO .Xr cmp 1 , .Xr diff 1 , .Xr diff3 1 , .Xr vi 1 , .Xr re_format 7 .Sh AUTHORS .Nm was written from scratch for the public domain by .An Ray Lai Aq ray@cyth.net . .Sh CAVEATS Tabs are treated as anywhere from one to eight characters wide, depending on the current column. Terminals that treat tabs as eight characters wide will look best.