SDIFF(1,C) AIX Commands Reference SDIFF(1,C)
-------------------------------------------------------------------------------
sdiff
PURPOSE
Compares two files and displays the differences in a side-by-side format.
SYNTAX
+--------+ +- -w130 --+ +--------------+
sdiff ---| one of |---| |---| |-- file1 -- file2 --|
| +----+ | +- -w num -+ +- -o outfile -+
+-| -l |-+
| -s |
+----+
Note: This command does not have MBCS support.
DESCRIPTION
The sdiff command reads file1 and file2, uses diff to compare them, and writes
the results to standard output in a side-by-side format. sdiff displays each
line of the two files with a series of blanks between them if the lines are
identical, a < (less than sign) in the field of blanks if the line only exists
in file1, a > (greater than sign) if the line only exists in file2, and a |
(vertical bar) for lines that are different.
When you specify the -o flag, sdiff produces a third file by merging file1 and
file2 according to your instructions.
FLAGS
-l Displays only the left side when lines are identical.
-o outfile Creates a third file, outfile, by a controlled line-by-line
merging of file1 and file2. The following subcommands govern
the creation of this file:
l Adds the left side to outfile.
r Adds the right side to outfile.
s Stops displaying identical lines.
v Begins displaying identical lines.
e l
Processed November 8, 1990 SDIFF(1,C) 1
SDIFF(1,C) AIX Commands Reference SDIFF(1,C)
e r
e b Starts ed with the left side, the right side, both
sides, or an empty file, respectively.
e Each time you exit from ed, sdiff writes the resulting
edited file to the end of outfile. If you fail to save
the changes before exiting, sdiff writes the initial
input to outfile.
q Exits the program.
-s Does not display identical lines.
-w num Sets the width of the output line to num, 130 characters, by
default.
EXAMPLES
1. To print a comparison of two files:
sdiff chap1.bak chap1 | print
This prints a side-by-side listing that compares each line of "chap1.bak"
and "chap1". The "| print" sends the listing to the print command. sdiff
assumes that your printer has wide paper (130 columns).
2. To display only the lines that differ:
sdiff -s -w 80 chap1.bak chap1
This displays the differences at the work station. The -w" 80" sets page
width to 80 columns. The -s flag tells sdiff not to display lines that are
identical in both files.
3. To selectively combine parts of two files:
sdiff -s -w 80 -o chap1.combo chap1.bak chap1
This combines "chap1.bak" and "chap1" into a new file called "chap1.combo".
For each group of differing lines, sdiff asks you which group to keep or
whether you want to edit them using ed.
RELATED INFORMATION
See the following commands: "diff" and "ed, red."
Processed November 8, 1990 SDIFF(1,C) 2