LinuxCommandLibrary

diffmk

SYNOPSIS

diffmk [-a] oldfile newfile

PARAMETERS

-a
    Mark all lines between first and last changed line on each affected page, plus explicit changes.

DESCRIPTION

diffmk is a specialized utility for comparing two versions of a troff or nroff input file and generating a marked-up version of the newer file highlighting changes. It invokes diff -n internally to identify differences numerically, then processes the newfile to insert a vertical bar (|) immediately after the first character of changed words or lines.

This markup enables troff/nroff to render changes distinctly—typically as underlining on line printers or boldface on terminals—facilitating review of document revisions in traditional Unix typesetting workflows.

By default, only explicitly altered content is marked. The output mirrors newfile structure but with precise insertions for visual cues during formatting. Ideal for technical documentation, man pages, or any troff-based sources, diffmk integrates seamlessly with tools like tbl, eqn, and device drivers. Redirect output to a file for subsequent processing, ensuring changes stand out without altering semantics.

Limited to text-based troff files, it excels where line-oriented diffs suffice but assumes consistent formatting.

CAVEATS

Tailored for troff/nroff sources; suboptimal on binary files, heavy macros, or major restructurings shifting line numbers. Uses diff -n, ignoring trailing whitespace but sensitive to order. Output requires troff-compatible formatter for markup visibility.

USAGE EXAMPLE

diffmk doc.old doc.new > doc.marked

nroff -Tlp doc.marked | lpr

MARKUP DETAILS

Changed text prefixed by | after first char; troff renders as underline (-Tlp) or bold. Uppercase | prints lowercase; bar itself vanishes.

HISTORY

Developed in the 1970s by AT&T Bell Labs for the original Unix troff system to support revision tracking in document preparation. Ported and maintained in the GNU groff project since 1990s, available on modern Linux distributions via groff package.

SEE ALSO

diff(1), troff(1), nroff(1), groff(1), tbl(1), eqn(1)

Copied to clipboard