Up: unify   [Contents]

4.1 Invoking unify

The format for running the unify program is:

unify option … [file]

The program reads the diff to convert from file, or if the source file is not mentioned, it will be read from the standard input. The default is to output the diff in the opposite style of whatever was input, that is, regular context diffs will become unified context diffs, and unified context diffs will become unified context diffs, but this can be overridden by options.

unify supports the following command line options:


Merely prints the version numbers on standard output, and exits without doing anything else.


Merely prints a page of help on standard output, and exits without doing anything else.


Forces context diff output.


Echoes non-diff (comment) lines to stderr. If a comment line is being stripped via the -p option, it is echoed with a preceding ‘!!! ’. If all comments are being stripped (via the -s option), no special designation is given.


Is used to force a context diff to be interpreted as being of the old-style even if it has the extra trailing asterisks that normally mark the new-style. This is only needed if unify fails to work with your version of diff.


Turns on patch-output mode. This will do two things:

  1. Transform a header like:
    *** orig/file	Sat May  5 02:59:37 1990
    --- ./file	Sat May  5 03:00:08 1990

    into a line of ‘Index: file’ — we choose the shorter name and strip a leading ‘./’ sequence if present.

  2. Strip lines that begin with ‘Only in ’, ‘Common subdir’, ‘Binary files’ or ‘diff -’.

Is the same as -p.


Strips non-diff lines (comments).


Forces unified diff output.


Is the same as -up.


Will use a ‘=’ prefix in a unified diff for lines that are common to both files instead of using a leading space. Though this is harder to read, it is less likely to be mangled by trailing-space-stripping sites when posted to Usenet.

Up: unify   [Contents]