EDITOR, VISUAL
Specifies an editor to use with the -o option. If both EDITOR and VISUAL are set, VISUAL takes precedence. If neither EDITOR nor VISUAL are set, the default is vi(1).
Side-by-side diff
sdiff [-abdilstW]
[-I
regexp]
[-o
outfile]
[-w
width]
file1
file2
sdiff displays two files side by side, with any differences between the two highlighted as follows: new lines are marked with ‘>’; deleted lines are marked with ‘<’; and changed lines are marked with ‘|’.
sdiff can also be used to interactively merge two files, prompting at each set of differences. See the -o option for an explanation.
The options are:
-l
Only print the left column for identical lines.
-o outfile
Interactively merge file1 and file2 into outfile. In this mode, the user is prompted for each set of differences. See EDITOR and VISUAL, below, for details of which editor, if any, is invoked.
The commands are as follows:
l | 1Choose left set of diffs.
r | 2Choose right set of diffs.
b l | b 1Choose both, left set of diffs first.
b r | b 2Choose both, right set of diffs first.
sSilent mode – identical lines are not printed.
vVerbose mode – identical lines are printed.
eStart editing an empty file, which will be merged into outfile upon exiting the editor.
e lStart editing file with left set of diffs.
e rStart editing file with right set of diffs.
e bStart editing file with both sets of diffs.
qQuit sdiff.
-s
Skip identical lines.
-w width
Print a maximum of width characters on each line. The default is 130 characters.
Options passed to diff(1) are:
-a
Treat file1 and file2 as text files.
-b
Ignore trailing blank spaces.
-d
Minimize diff size.
-I regexp
Ignore line changes matching regexp. All lines in the change must match regexp for the change to be ignored.
-i
Do a case-insensitive comparison.
-t
Expand tabs to spaces.
-W
Ignore all spaces (the -w flag is passed to diff(1)).
EDITOR, VISUAL
Specifies an editor to use with the -o option. If both EDITOR and VISUAL are set, VISUAL takes precedence. If neither EDITOR nor VISUAL are set, the default is vi(1).
TMPDIR
Specifies a directory for temporary files to be created. The default is /tmp.
The sdiff utility exits with one of the following values:
0
No differences were found.
1
Differences were found.
1
An error occurred.
Although undocumented, sdiff supports most long options supported by GNU sdiff, though some require GNU diff.
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.
56 releases since OpenBSD 2.1; the text changed 10 times.
--expand-tabs until OpenBSD 3.3;
--ignore-all-space until OpenBSD 3.3;
--ignore-blank-lines until OpenBSD 3.3;
--ignore-case until OpenBSD 3.3;
--ignore-matching-lines until OpenBSD 3.3;
--ignore-space-change until OpenBSD 3.3;
--left-column until OpenBSD 3.3;
--minimal until OpenBSD 3.3;
--output until OpenBSD 3.3;
--speed-large-files until OpenBSD 3.3;
--suppress-common-lines until OpenBSD 3.3;
--text until OpenBSD 3.3;
--version until OpenBSD 3.3;
--width until OpenBSD 3.3;
-B until OpenBSD 3.3;
-H until OpenBSD 3.3;
-v until OpenBSD 3.3.