Linux and Unix sdiff command

Quick links

About sdiff
Syntax
Examples
Related commands
Linux and Unix main page

About sdiff

Compares two files, side-by-side.

Syntax

sdiff [ -l ] [ -s ] [ -o output ] [ -w n ] filename1 filename2

-lPrint only the left side of any lines that are identical to.
-sJust prints the lines that are different.
-o outputUse the argument output as the name of a third file that is created as a user-controlled merge of filename1 and filename2. Identical lines of filename1 and filename2 are copied to output. Sets of differences, as produced by diff , are printed; where a set of differences share a common gutter character. After printing each set of differences, sdiff prompts the user with a % and waits for one of the following user-typed commands: 
lAppend the left column to the output file.
rAppend the right column to the output
file.
sTurn on silent mode; do not print identical lines.
vTurn off silent mode.
e lCall the editor with the left column.
e rCall the editor with the right column.
e bCall the editor with the concatenation of left and right.
eCall the editor with a zero length file.
qExit from the program.

On exit from the editor, the resulting file is concatenated to the end of the output file.

-w nUse the argument n as the width of the output line. The default line length is 130 characters.
filename1The first name of the file that you want to compare.
filename2The second name of the file that you want to compare.

Examples

sdiff myfile.txt myfile2.txt

Lists results similar to the below.

is this ln                 |      cat in the hat

Hello world           <
this is a test           <
of the ed editor     <

Related commands

diff
ed