Name | Synopsis | Description | Options | Exit status | Caveats | Authors | See also | COLOPHON |
|
|
gdiffmk(1) General Commands Manual gdiffmk(1)
gdiffmk - mark differences between groff/nroff/troff files
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
gdiffmk compares two 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.
--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)'s -D extension option. -- Treat all subsequent arguments as file names, even if they begin with “-”.
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) or sh(1) commands do not support features gdiffmk requires; and 4 if the output argument is a duplicate of file1 or file2.
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.
gdiffmk was written by Mike Bianchi ⟨MBianchi@Foveal.com⟩, now retired. It is maintained by the groff developers.
groff(1), nroff(1), troff(1), roff(7), diff(1)
This page is part of the groff (GNU troff) project. Information
about the project can be found at
⟨http://www.gnu.org/software/groff/⟩. If you have a bug report for
this manual page, see ⟨http://www.gnu.org/software/groff/⟩. This
page was obtained from the project's upstream Git repository
⟨https://git.savannah.gnu.org/git/groff.git⟩ on 2025-08-11. (At
that time, the date of the most recent commit that was found in
the repository was 2025-08-09.) If you discover any rendering
problems in this HTML version of the page, or you believe there is
a better or more up-to-date source for the page, or you have
corrections or improvements to the information in this COLOPHON
(which is not part of the original manual page), send a mail to
man-pages@man7.org
groff 1.23.0.3821-a8b3f 2025-08-09 gdiffmk(1)