---
name: "gdiffmk"
section: "1"
platform: "linux"
package: "groff"
version: "1.24.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/gdiffmk"
---

# gdiffmk(1)

mark differences between groff/nroff/troff files

## Name

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

## 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

*gdiffmk* compares two [*roff*(7)](/roff/7.md) 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

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

- **-a** *add-mark*

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

- **-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*

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

- **-d** *delete-mark*

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

- **-D**

  Mark changed and deleted material with surrounding delimiters.

- **-M** *mark1 mark2*

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

- **-x** *diff-command*

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

- **--**

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

## 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)](/diff/1.md) or [*sh*(1)](/sh/1.md) commands do not support features *gdiffmk* requires; and **4** if the *output* argument is a duplicate of *file1* or *file2*.

## 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

*gdiffmk* was written by Mike Bianchi ⟨MBianchi@\\:Foveal\\:.com⟩, now retired. It is maintained by the *groff* developers.

## See also

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