SDIFF(1) General Commands Manual SDIFF(1)

sdiffside-by-side diff

sdiff [-abdilstHW] [-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:

--left-column
Only print the left column for identical lines.
--output 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:

|
Choose left set of diffs.
|
Choose right set of diffs.
Silent mode – identical lines are not printed.
Verbose mode – identical lines are printed.
Start editing an empty file, which will be merged into outfile upon exiting the editor.
l
Start editing file with left set of diffs.
r
Start editing file with right set of diffs.
b
Start editing file with both sets of diffs.
Quit sdiff.
--suppress-common-lines
Skip identical lines.
--width width
Print a maximum of width characters on each line. The default is 130 characters.

Options passed to diff(1) are:

--text
Treat file1 and file2 as text files.
--ignore-space-change
Ignore trailing blank spaces.
--minimal
Minimize diff size.
--ignore-matching-lines regexp
Ignore line changes matching regexp. All lines in the change must match regexp for the change to be ignored.
--ignore-case
Do a case-insensitive comparison.
--expand-tabs
Expand tabs to spaces.
--ignore-all-space
Ignore all spaces.
--ignore-blank-lines
Ignore blank lines.
--ignore-tab-expansion
Treat tabs and eight spaces as the same.
--ignore-tabs
Ignore tabs.
--speed-large-files
Assume scattered small changes in a large file.
Ignore the case of file names.
Do not ignore file name case.
Skip identical lines.
NUM
Change the size of tabs (default is 8.)
PROGRAM
Use PROGRAM to compare files.

, 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).
Specifies a directory for temporary files to be created. The default is /tmp.

cmp(1), diff(1), diff3(1), vi(1), re_format(7)

sdiff was written from scratch for the public domain by Ray Lai ⟨ray@cyth.net⟩.

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.

April 8, 2017 macOS 14.6