Name

sdiff

Synopsis

    sdiff [options]file1 file2

Produce a side-by-side comparison of file1 with file2. Output is:

text text

Identical lines.

text <

Line that exists only in file1.

> text

Line that exists only in file2.

text | text

Lines that are different.

GNU/Linux and Mac OS X both use the GNU version of sdiff.

Common Options

-l, --left-column

List only lines of file1 that are identical.

-ooutfile, --output=outfile

Send identical lines of file1 and file2 to outfile; print line differences and edit outfile by entering, when prompted, the following commands:

e

Edit an empty file.

e b

Edit both left and right columns.

e l

Edit left column.

e r

Edit right column.

l

Append left column to outfile.

q

Exit the editor.

r

Append right column to outfile.

s

Silent mode; do not print identical lines.

v

Turn off “silent mode.”

-s, --suppress-common-lines

Do not print identical lines.

-wcols, --width=cols

Set line length to cols (default is 130).

GNU sdiff Options

-a, --text

Treat all files as text and compare line-by-line.

-b, --ignore-space-change

Ignore differences in whitespace.

-B, --ignore-blank-lines

Ignore added or missing blank lines.

-d, --minimal

Use a different algorithm to find fewer changes. This option causes sdiff to run more slowly.

--diff-program= program

Use program in place of the standard version of diff.

-E, --ignore-tab-expansion

Ignore changes occurring because of tab expansion.

-H, --speed-large-files

Heuristically speed comparison of large files with many small ...

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.