LinuxCommandLibrary

gdiffmk

Highlight differences between files for gdiff

SYNOPSIS

gdiffmk [-a|-A] [-d dev] [-h] [-i] [-o|-O] [-x|-X] oldfile newfile

PARAMETERS

-a
    Treat all text literally; do not canonicalize whitespace.

-A
    Like -a, but also ignore letter case differences.

-d dev
    Use dev as output device name (default: ps); affects markup.

-h
    Alternative algorithm for horizontal text position comparison (ignores device shifts).

-i
    Ignore differences in vertical whitespace only.

-o
    Overstrike changed portions of old file with black.

-O
    Overstrike changed portions of both old and new files with black.

-x
    Omit common header material from diff markup.

-X
    Suppress page insertion codes in output.

DESCRIPTION

gdiffmk is a GNU groff utility for generating markup to highlight differences between two similar groff-formatted output files, such as PostScript (PS) documents produced from revised input sources. It compares oldfile and newfile, embedding special groff requests in the output that draw colored boxes around changed text regions when reprocessed by gtroff or groff.

Deletions (text present in old but not new) are marked with a thin red border and black overstrike. Insertions (text only in new) get a blue border. This enables high-quality printed or PDF diffs for technical documentation, manuals, or publications.

Usage workflow: format inputs with identical groff options to generate PS files, then pipe gdiffmk output through groff for visualization. Options fine-tune comparison by ignoring whitespace, case, or device-specific positioning shifts.

Primarily for PS (−d ps default), but supports other devices like dvi. Ideal for version-controlled documents where semantic diffs matter over raw text changes.

CAVEATS

Requires input files from identical groff invocations for accurate diffs; device/format mismatches cause poor results. Output is raw markup —must pipe to groff for viewable PS/PDF.

EXAMPLE WORKFLOW

groff −Tps input1.ms > old.ps
groff −Tps input2.ms > new.ps
gdiffmk old.ps new.ps | groff −Tps > marked.ps

MARKUP COLORS

Deletions: thin red box + black overstrike.
Insertions: blue box.

HISTORY

Developed for GNU groff (1990s) as FSF replacement for proprietary AT&T Unix diffmk; maintained in groff releases for typesetting diffs.

SEE ALSO

diffmk(1), groff(1), gtroff(1), diff(1)

Copied to clipboard