DWDIFF(1)
π DWDIFF(1) β the delimited word diff program π
okay bestie, sit DOWN because this is the manual page for dwdiff, aka the delimited word diff program, and it's genuinely one of the most underrated little tools out there. no cap. it's giving "I do what diff does but β¨cuterβ¨ and at the word level."
β¨ SYNOPSIS β¨
dwdiff [OPTIONS] OLD FILE NEW FILE
dwdiff [OPTIONS] --diff-input [DIFF FILE]
πΈ DESCRIPTION πΈ
so dwdiff is a diff program that works at the word level instead of the boring old line level. the way that it's different from wdiff is: it lets you decide what counts as whitespace, and it takes an optional list of characters that should be treated as delimiters. delimiters are single characters that get treated as if they were words β even when there's no whitespace separating them from the words or delimiters around them. iconic behaviour honestly.
dwdiff is mostly command-line compatible with wdiff. only the --autopager, --terminal and --avoid-wraps options are not supported. (sorry babes π)
the default output from dwdiff is the new text, with the deleted and inserted parts annotated with markers. command line options are available to change both what is printed, and the markers. obsessed.
π OPTIONS π
dwdiff accepts the following options (note that all strings will first be escape expanded. all standard \-escapes are supported, as well as \u and \U Unicode escapes):
-h,--helpβ display a short help message. bestie behaviour.-v,--versionβ print version and copyright information. β¨-ddelimiters,--delimiters=delimiters β specify a list of characters to be used as delimiters. the default is empty.-P,--punctuationβ use punctuation characters as delimiters. the exact set of punctuation characters depends on the current locale. iykyk.-Wwhitespace,--white-space=whitespace β specify a list of characters to be used as whitespace. the default set of whitespace characters depends on the current locale.-u,--diff-inputβ interpret the input as the output fromdiffin the Unified Diff format (usually produced bydiff -u). in this case only one input file is allowed. this option allows reformatingdiffoutput withdwdiff, and is useful for example to post-process the output ofsvn diff. chef's kiss π«Ά-1,--no-deletedβ suppress printing of words deleted from the first file.-2,--no-insertedβ suppress printing of words inserted in the second file.-3,--no-commonβ suppress printing of words common to both files.-L[width],--line-numbers[=width]β show line numbers at the start of each line. the line numbers displayed are the line number in the old file and the line number in the new file respectively. the optional width argument is the minimum number of positions per line number.-Cnum,--context=numβ show num lines of context before and after each changes. a line with only--is printed between blocks of changes.-s,--statisticsβ print statistics when done. the numbers printed include the number of words from in both files, the number of deleted words, the number of inserted words, and the number of changed words. the number of changed words is counted as the number of words that are removed from the first file, and the number of words that replace them from the second file. all of these numbers are also expressed as a percentage of the total number of words in the file the words came from. π-i,--ignore-caseβ ignore differences in case when comparing words. this option is only available if thediffprogram that is called provides it.-I,--ignore-formattingβ ignore differences in formatting of characters. this option switches to using the Unicode compatibility decomposition instead of the canonical decomposition. the compatibility decomposition discards formatting information. for example, the ligaturefiwill be decomposed into two separate characters for the purposes of comparison. however, also super- and subscript will be regarded equal as well as different rotations of the same character. wild, right?-c[spec],--color[=spec]β color mode. the optional spec can be used to customize the colors. spec consists of[delete],[insert]. if either is omited it will be set to its default color (bright red or bright green respectively). both parts of the spec consist of[foreground][:background]. to obtain a list of permissible color names, use the word ``list'' as spec. alternatively, you can specify any escape sequence to set attributes as a color by prependinge:.
the standard markers for the begin and end of deleted and inserted text are suppressed, but any markers specified on the command line will still be printed. π
-l,--less-modeβ as-pbut also overstrike deleted whitespace.-p,--printerβ use overstriking with an underscore and bold text to emphasize changes. this is implemented by first printing the underscore or a duplicate of the character to be printed, followed by a backspace, followed by the character. on regular terminals you won't see any effect. theless(1)command will however show underlined and bold text.
the standard markers for the begin and end of deleted and inserted text are suppressed, but any markers specified on the command line will still be printed.
-mnum,--match-context=numβ use num words of context before and after words for matching. words in the old text will then only match words in the new text if words surrounding them are also equal. this improves the output fordwdifffor large changes with frequently occurring words. however, using context requires more disk space and more processing time. the default value is1. set this option to0to revert to the pre 1.5 behavior. π°οΈ--aggregate-changesβ allow multiple close changes to be treated as one change, if context words are used (see--match-context). this option reduces the processing time as the changes reported by thediffprogram are not post-processed to give more precise results.-Aalgorithm,--algorithm=algorithm β select the algorithm to be used for determining differences. there are three possible values for algorithm:best, which tries to find the minimal set of changes,normal, which trades some optimality for speed, andfast, which assumes that the input is large and contains few changes. by default thenormalalgorithm is used.-S[marker],--paragraph-separator[=marker]β show insertion or deletion of blocks of lines with only whitespace characters. a special marker is inserted into the output to indicate these blocks. the default marker is--.--wdiff-outputβ createwdiffcompatible output. thedwdiffprogram uses a different output algorithm, which provides a more intuitive output.-wstring,--start-delete=string β specify a string to mark begin of deleted text. the default is[-.-xstring,--stop-delete=string β specify a string to mark end of deleted text. the default is-].-ystring,--start-insert=string β specify a string to mark begin of inserted text. the default is{+.-zstring,--stop-insert=string β specify a string to mark end of inserted text. the default is+}.-R,--repeat-markersβ repeat the begin and end markers at the start and end of line if a change crosses a newline.--profile=name β load the profile with name name from the.dwdiffrcfile in the user's home directory. only the last profile named is actually read, unless it is followed by a--no-profileoption. by default the profile nameddefaultis read.--no-profileβ disable reading of profiles, unless followed by another--profileoption. this also disables reading the default profile.
a single dash (-) as a file can be used to denote standard input. only one file can be read from standard input. to stop dwdiff from interpreting file names that start with a dash as options, one can specify a double dash (--) after which dwdiff will interpret any following arguments as files to read.
the exit status ofdwdiffindicates the result of the comparison:0if the files are the same,1if the files are different. should an error occur,dwdiffwill exit with status2. bestie, check your exit codes, fr fr.
π PROFILES π
since version 2.1.0, dwdiff allows users to create profiles. a profile is a set of options that can be loaded using the --profile option. profiles are specified in the .dwdiffrc in the user's home directory. the format of the .dwdiffrc file is as follows:
a line contains either a profile header (a text enclosed in []) or a long option name without leading dashes, optionally followed by it's argument. arguments are stripped of whitespace surrounding it. if an argument starts and ends with matching double or single quotes, these are removed as well. comments can be included by starting a line with a hash mark (#).
if no profile is specified, the profile named default will be loaded, unless the --no-profile option is specified. here is an example .dwdiffrc:
[default]
color red,blue
punctuation
[html]
start-delete <span style="color=red">
stop-delete </span>
start-insert <span style="color=green">
stop-insert </span>
[space-only]
# Use only a space as whitespace.
white-space " "
π BUGS π
if you think you have found a bug, please check that you are using the latest version of dwdiff <http://os.ghalkes.nl/dwdiff.html>. when reporting bugs, please include a minimal example that demonstrates the problem. (minimal!! not your whole 4000-line config file, bestie π)
π AUTHOR π
G.P. Halkes <dwdiff@ghalkes.nl>
π COPYRIGHT π
Copyright Β© 2006-2017 G.P. Halkes and others dwdiff is licensed under the GNU General Public License version 3. for more details on the license, see the file COPYING in the documentation directory. on Un*x systems this is usually /usr/share/doc/dwdiff-$VERSION$.
π SEE ALSO π
dwfilter(1), wdiff(1), diff(1)
and that's the whole page, bestie!! this one was version $VERSION$, dated 2018/12/03, straight from the DWDIFF(1) manual. go forth and diff your words πβ¨π¦π
π¦ where this page comes from
- debian bookworm: dwdiff 2.1.4-2+b2 Β· GPL-3.0-or-later
- debian trixie: dwdiff 2.1.4-2+b3 Β· GPL-3.0-or-later
- nixos 26.05: dwdiff 2.1.4
- nixpkgs unstable: dwdiff 2.1.4
- ubuntu jammy: dwdiff 2.1.4-1build1 Β· GPL-3.0-or-later
- ubuntu noble: dwdiff 2.1.4-2build2 Β· GPL-3.0-or-later
- ubuntu questing: dwdiff 2.1.4-2build3
- ubuntu resolute: dwdiff 2.1.4-2build4 Β· GPL-3.0-or-later
- ubuntu stonking: dwdiff 2.1.4-2build4 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms