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:
- Only print the left column for identical lines.
- Interactively merge file1 and
file2 into outfile. In this
mode, the user is prompted for each set of differences. See
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.
- Start editing file with left set of diffs.
- Start editing file with right set of diffs.
- Start editing file with both sets of diffs.
- Skip identical lines.
- Print a maximum of width characters on each line.
The default is 130 characters.
Options passed to diff(1)
- Treat file1 and file2 as text
- Ignore trailing blank spaces.
- Minimize diff size.
- Ignore line changes matching regexp. All lines in
the change must match regexp for the change to be
- Do a case-insensitive comparison.
- Expand tabs to spaces.
- Ignore all spaces (the
-w flag is passed to
- Specifies an editor to use with the
-o option. If
VISUAL takes precedence. If neither
VISUAL are set,
the default is vi(1).
- Specifies a directory for temporary files to be created. The default is
sdiff utility exits with one of the following
- No differences were found.
- Differences were found.
- An error occurred.
sdiff has been available since OpenBSD
sdiff was written from scratch for the public domain by
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.
sdiff may not work with binary data.