Comparing and Merging Files - 15. Invoking sdiff

Go to the first, previous, next, last section, table of contents.

# 15. Invoking `sdiff`

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

    sdiff -o outfile options... from-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.

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

`sdiff` without ``-o'` (or ``--output'`) produces a side-by-side difference. This usage is obsolete; use ``diff --side-by-side'` instead.

## 15.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'`
  Treat all files as text and compare them line-by-line, even if they do not appear to be text. See section 1.7 Binary Files and Forcing Text Comparisons.
``-b'`
  Ignore changes in amount of white space. See section 1.2 Suppressing Differences in Blank and Tab Spacing.
``-B'`
  Ignore changes that just insert or delete blank lines. See section 1.3 Suppressing Differences in Blank Lines.
``-d'`
  Change the algorithm to perhaps find a smaller set of changes. This makes `sdiff` slower (sometimes much slower). See section 5. `diff` Performance Tradeoffs.
``-H'`
  Use heuristics to speed handling of large files that have numerous scattered small changes. See section 5. `diff` Performance Tradeoffs.
``--expand-tabs'`
  Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files. See section 4.1 Preserving Tabstop Alignment.
``-i'`
  Ignore changes in case; consider upper- and lower-case to be the same. See section 1.4 Suppressing Case Differences.
``-I regexp'`
  Ignore changes that just insert or delete lines that match regexp. See section 1.5 Suppressing Lines Matching a Regular Expression.
``--ignore-all-space'`
  Ignore white space when comparing lines. See section 1.2 Suppressing Differences in Blank and Tab Spacing.
``--ignore-blank-lines'`
  Ignore changes that just insert or delete blank lines. See section 1.3 Suppressing Differences in Blank Lines.
``--ignore-case'`
  Ignore changes in case; consider upper- and lower-case to be the same. See section 1.4 Suppressing Case Differences.
``--ignore-matching-lines=regexp'`
  Ignore changes that just insert or delete lines that match regexp. See section 1.5 Suppressing Lines Matching a Regular Expression.
``--ignore-space-change'`
  Ignore changes in amount of white space. See section 1.2 Suppressing Differences in Blank and Tab Spacing.
``-l'`
``--left-column'`
  Print only the left column of two common lines. See section 2.5 Controlling Side by Side Format.
``--minimal'`
  Change the algorithm to perhaps find a smaller set of changes. This makes `sdiff` slower (sometimes much slower). See section 5. `diff` Performance Tradeoffs.
``-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 section 2.5 Controlling Side by Side Format.
``--speed-large-files'`
  Use heuristics to speed handling of large files that have numerous scattered small changes. See section 5. `diff` Performance Tradeoffs.
``-t'`
  Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files. See section 4.1 Preserving Tabstop Alignment.
``--text'`
  Treat all files as text and compare them line-by-line, even if they do not appear to be text. See section 1.7 Binary Files and Forcing Text Comparisons.
``-v'`
``--version'`
  Output the version number of `sdiff`.
``-w columns'`
``--width=columns'`
  Use an output width of columns. See section 2.5 Controlling Side by Side Format. Note that for historical reasons, this option is ``-W'` in `diff`, ``-w'` in `sdiff`.
``-W'`
  Ignore horizontal white space when comparing lines. See section 1.2 Suppressing Differences in Blank and Tab Spacing. Note that for historical reasons, this option is ``-w'` in `diff`, ``-W'` in `sdiff`.

Go to the first, previous, next, last section, table of contents.