Next: , Previous: , Up: Comparing and Merging Files   [Contents][Index]

16 Invoking sdiff

The sdiff command merges two files and interactively outputs the results. Its arguments are as follows:

sdiff -o outfile optionsfrom-file to-file

This merges from-file with to-file, with output to outfile. If from-file is a directory and to-file is not, sdiff compares the file in from-file whose file name is that of to-file, and vice versa. from-file and to-file may not both be directories.

sdiff options begin with ‘-’, so normally from-file and to-file may not begin with ‘-’. However, -- as an argument by itself treats the remaining arguments as file names even if they begin with ‘-’. You may not use - as an input file.

sdiff without --output (-o) produces a side-by-side difference. This usage is obsolete; use the --side-by-side (-y) option of diff instead.

An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble.


16.1 Options to sdiff

Below is a summary of all of the options that GNU sdiff accepts. Each option has two equivalent names, one of which is a single letter preceded by ‘-’, and the other of which is a long name preceded by ‘--’. Multiple single letter options (unless they take an argument) can be combined into a single command line argument. Long named options can be abbreviated to any unique prefix of their name.

-a
--text

Treat all files as text and compare them line-by-line, even if they do not appear to be text. See Binary Files and Forcing Text Comparisons.

-b
--ignore-space-change

Ignore changes in amount of white space. See Suppressing Differences in Blank and Tab Spacing.

-B
--ignore-blank-lines

Ignore changes that just insert or delete blank lines. See Suppressing Differences Whose Lines Are All Blank.

-d
--minimal

Change the algorithm to perhaps find a smaller set of changes. This makes sdiff slower (sometimes much slower). See diff Performance Tradeoffs.

--diff-program=program

Use the compatible comparison program program to compare files instead of diff.

-E
--ignore-tab-expansion

Ignore changes due to tab expansion. See Suppressing Differences in Blank and Tab Spacing.

--help

Output a summary of usage and then exit.

-i
--ignore-case

Ignore changes in case; consider upper- and lower-case to be the same. See Suppressing Case Differences.

-I regexp
--ignore-matching-lines=regexp

Ignore changes that just insert or delete lines that match regexp. See Suppressing Differences Whose Lines All Match a Regular Expression.

-l
--left-column

Print only the left column of two common lines. See Controlling Side by Side Format.

-o file
--output=file

Put merged output into file. This option is required for merging.

-s
--suppress-common-lines

Do not print common lines. See Controlling Side by Side Format.

--speed-large-files

Use heuristics to speed handling of large files that have numerous scattered small changes. See diff Performance Tradeoffs.

--strip-trailing-cr

Strip any trailing carriage return at the end of an input line. See Binary Files and Forcing Text Comparisons.

-t
--expand-tabs

Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files. See Preserving Tab Stop Alignment.

--tabsize=columns

Assume that tab stops are set every columns (default 8) print columns. See Preserving Tab Stop Alignment.

-v
--version

Output version information and then exit.

-w columns
--width=columns

Output at most columns (default 130) print columns per line. See Controlling Side by Side Format. Note that for historical reasons, this option is -W in diff, -w in sdiff.

-W
--ignore-all-space

Ignore white space when comparing lines. See Suppressing Differences in Blank and Tab Spacing. Note that for historical reasons, this option is -w in diff, -W in sdiff.

-Z
--ignore-trailing-space

Ignore white space at line end. See Suppressing Differences in Blank and Tab Spacing.


Next: , Previous: , Up: Comparing and Merging Files   [Contents][Index]