[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 2

diffmk Command

Purpose

Marks differences between files.

Syntax

diffmk [ { -abX | -aeX ] [ -b ] [ -cbX | -ceX ] [ -dbX | -deX ] File1 File2 [ File3 ]

Description

The diffmk command compares the English-language file specified by the File1 parameter with the file by the File2 parameter. It then creates a third file that includes .mc requests (for creating change marks) for the nroff and troff commands. The File1 and File2 parameters specify the old and new versions, respectively, of the files. The diffmk command writes the newly created file to the File3 parameter, if specified, or else to standard output. The File3 file contains the lines of the File2 file plus inserted formatter .mc requests. When the File3 file is formatted, the changed or inserted text is marked by a | (vertical bar) at the right margin of each line. An * (asterisk) in the margin indicates that a line was deleted.

If the DIFFMARK environment variable is defined, it names a command string that the diffmk command uses to compare the files. (Normally, the diffmk command uses the diff command.) For example, to handle extremely large files better, you can set the DIFFMARK variable to diff -h.

Parameters

File1 Specifies an English-language file that is compared to the file specified by the File2 parameter. The results of the comparison comprise the file specified by the File3 parameter. File1 is considered the "old" file.
File2 Specifies an English-language file that is compared to the file specified by the File1 parameter. The results of the comparison comprise the file specified by the File3 parameter. File2 is considered the "new" file.
File3 Specifies a file that contains lines of the File2 file and includes inserted formatter .mc requests for the nroff and troff commands. The contents of this file are the results of a comparison between the files specified by the File1 and File2 parameters. When formatted, the changed text is marked by a (|) vertical bar at the right margin of each line. An * (asterisk) indicates the line was deleted. If File3 is not specified, the results of the comparison are written to standard input.

Flags

-abX Uses X to mark where added lines begin.
-aeX Uses X to mark where added lines end.
-b Ignores differences that are only changes in tabs or spaces on a line.
-cbX Uses X to mark where changed lines begin.
-ceX Uses X to mark where changed lines end.
-dbX Uses X to mark where deleted lines begin.
-deX Uses X to mark where deleted lines end.

Examples

  1. To mark the differences between two versions of a text file, enter:

    diffmk chap1.old chap1 chap1.nroff

    This produces a copy of chap1 containing nroff and troff change mark requests to identify text that has been added to, changed in, or deleted from chap1.old. This copy is saved in the chap1.nroff file.

  2. To mark differences with non-nroff and troff messages, enter:

    diffmk -ab'>>New:' -ae'<<End New' \
    chap1.old chap1 chap1.nroff

    This causes the diffmk command to write >>New: on the line before a section of newly added lines to chap1, and to write <<End New on the line following the added lines. Changes and deletions still generate nroff and troff commands to put a | (vertical bar) or * (asterisk) in the margin.

  3. To use different nroff and troff command-marking requests and ignore changes in white space, enter:

    diffmk -b -cb'.mc %' chap1.old chap1 chap1.nroff

    This imbeds commands that mark changes with % (percent sign) additions with a | (vertical bar), and deletions with an * (asterisk). It does not mark changes that only involve a different number of spaces or tabs between words (-b).

Related Information

The diff command, nroff command, troff command.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]