gdiffmk(1) General Commands Manual gdiffmk(1)

# [Name](#Name)

gdiffmk - mark differences between *groff*/*nroff*/*troff* files

# [Synopsis](#Synopsis)

`gdiffmk` \[**-a add-mark**] \[**-c change-mark**] \[**-d delete-mark**] \[**-x diff-command**] \[**-D** \[**-B**] \[**-M** *mark1 mark2*]] \[**--**] *file1* *file2* \[*output-file*]

`gdiffmk` **--help**

`gdiffmk` **--version**

# [Description](#Description)

*gdiffmk* compares two [*roff*(7)](/man/os/groff/roff.7) documents, *file1* and *file2*, and writes another, derived from both, to the standard output stream (or *output-file*), adding margin character (**mc**) requests at places in the output where the input documents differ. *gdiffmk* does not interpret the source documents; it treats *roff* comments and nilpotent changes to formatting as meaningful. For example, it does not know that **\\h'3m'**, **\\h'(1 * 3m)'**, and **\\h'3m+0'** all mean the same thing. If the *file1* or *file2* argument is “**-**”, *gdiffmk* reads the standard input stream for that input. If the *output* operand is present, *gdiffmk* writes output to a file of that name. If it is “**-**” or absent, *gdiffmk* writes output to the standard output stream. “**-**” cannot be both an input and output operand.

# [Options](#Options)

**--help** displays a usage message and **--version** shows version information; both exit afterward.

[**-a add-mark**](#a)

Annotate material absent from *file1* but present in *file2* with *add-mark* (default: “**+**”).

[**-B**](#B)

Suppress **br** requests normally inserted by **-D** option. Use with caution; such requests are the only way to guarantee that deletions and small changes are marked.

[**-c change-mark**](#c)

Annotate material differing between *file1* and *file2* with *change-mark* (default: “**|**”).

[**-d delete-mark**](#d)

Annotate material present in *file1* but absent from *file2* with *delete-mark* (default: “**\***”).

[**-D**](#D)

Mark changed and deleted material with surrounding delimiters.

[**-M mark1 mark2**](#M)

Use *mark1* (default: “**\[\[**”) and *mark2* (default: “**]]**”) as delimiters when using the **-D** option.

[**-x diff-command**](#x)

Use the *diff-command* program to perform the comparison of *file1* and *file2*. *diff-command* (default: **diff**) must accept GNU [*diff*(1)](/man/os/groff/diff.1)'s **-D** extension option.

**--**

Treat all subsequent arguments as file names, even if they begin with “**-**”.

# [Exit status](#Exit_status)

*gdiffmk* exits with status **0** if the input files are the same; **1** if they differ; **2** upon a usage error; **3** if the system's [*diff*(1)](/man/os/groff/diff.1) or [*sh*(1)](/man/os/groff/sh.1) commands do not support features *gdiffmk* requires; and **4** if the *output* argument is a duplicate of *file1* or *file2*.

# [Caveats](#Caveats)

The output is not necessarily compatible with all macro packages or preprocessors. A reliable workaround is to run *gdiffmk* on the output of the final preprocessor instead of the input source.

*gdiffmk* relies on the **-D** option of GNU *diff* to make a merged “#ifdef” output format. Busybox *diff* is known to not support it. Also see the **-x diff-command** option.

# [Authors](#Authors)

*gdiffmk* was written by [Mike Bianchi](mailto:MBianchi@Foveal.com), now retired. It is maintained by the *groff* developers.

# [See also](#See_also)

[*groff*(1)](/man/os/groff/groff.1), [*nroff*(1)](/man/os/groff/nroff.1), [*troff*(1)](/man/os/groff/troff.1), [*roff*(7)](/man/os/groff/roff.7), [*diff*(1)](/man/os/groff/diff.1)

2026-10-26 groff 1.24.2

---

Document: gdiffmk(1) from groff 1.24.2-r2 (Chainguard OS)
Source: https://git.savannah.gnu.org/git/groff.git
