sdiff(1) sdiff(1)
NAME
sdiff - side-by-side difference program
SYNOPSIS
sdiff[ option]... file1 file2
DESCRIPTION
sdiff displays the differences between two files on standard output.
The differences are those found by the diff(1) command. sdiff prints a
side-by-side listing of the two files on the standard output, marking
the lines that are different. Lines from file1 are displayed on the
left, lines from file2 on the right. Between the two files there is a
gutter containing characters that indicate identical and differing
lines. Identical lines have a blank gutter; lines that only exist in
file1 are marked by a < in the gutter, lines only in file2 by a >.
Lines which differ are marked | if there is an identical number of
identical lines or | lines before them or between them in the two
files.
OPTIONS
-l Prints only the left side (file1) of any lines that are identi-
cal.
-o outputfile
outputfile is the name of a third file that is created as a
user-controlled merging of file1 and file2. Identical lines of
file1 and file2 are copied to outputfile by default. Sets of
differences, as produced by sdiff, are printed on the screen, a
set being a group of differences sharing a common gutter charac-
ter. After printing each set of differences, sdiff prompts you
with a % and waits for you to type one of the following commands
and terminate it with <RETURN>. Several such commands can be
entered in immediate succession.
e[ ]l Calls the editor ed to work on the left column of the
last set of differing lines displayed.
e[ ]r Calls the editor ed to work on the right column of the
last set of differing lines displayed.
e[ ]b Calls the editor ed to work successively on the left and
right columns of the last set of differing lines
displayed.
e Calls the ed editor with an empty buffer.
l Appends the left column of the output generated by sdiff
to the contents of outputfile.
q Exits from the program.
Page 1 Reliant UNIX 5.44 Printed 11/98
sdiff(1) sdiff(1)
r Appends the right column of the output generated by sdiff
to outputfile.
s Silent mode; does not print identical lines. Before
printing the next set of differences, additionally
creates an ed-script [see ed(1)] containing the ed com-
mands that are needed to construct file2 from file1.
v Turns off option s.
On exit from the editor, the ed buffer is appended to the con-
tents of outputfile.
-s Does not print identical lines.
-w[ ]n
Sets the number of columns for output lines to n.
-w n not specified:
The default width of an output line is 130 characters.
file1 file2
Names of the two files that sdiff is to compare. If you specify a
directory for one of the two files, sdiff compares the second
file with a file of the same name in the specified directory.
sdiff issues an error message if it cannot find or access one of
the files. You will need read permission for the files and exe-
cute permission for the directory [see chmod(1)].
If you use a dash - as the name for file2, sdiff reads from stan-
dard input and compares what it reads there with file1.
EXAMPLE
The files file1 and file2 have the following contents:
file1: file2:
x y
a a
b d
c c
d
Page 2 Reliant UNIX 5.44 Printed 11/98
sdiff(1) sdiff(1)
The following output is produced by sdiff:
$ sdiff file1 file2
x | y
a a
b <
c <
d d
> c
SEE ALSO
diff(1), ed(1).
Page 3 Reliant UNIX 5.44 Printed 11/98