dwdiff
word-by-word file comparison
TLDR
SYNOPSIS
dwdiff [options] file1 file2
DESCRIPTION
dwdiff compares files word-by-word rather than line-by-line, making it easier to spot small changes in prose or documentation. It highlights deleted words (from the first file) and inserted words (in the second file).The tool is particularly useful for comparing text documents, translations, or any content where line-based diffs produce confusing output. It shows exactly which words changed between versions.
PARAMETERS
-c[spec], --color[=spec]
Color the output. An optional spec overrides the delete and insert colors.-l, --less-mode
Use overstriking (underline for deletions, bold for insertions), suitable for piping to less -R.-L[width], --line-numbers[=width]
Show line numbers at the start of each line.-s, --statistics
Print word counts and change percentages when done.-i, --ignore-case
Ignore differences in case when comparing words.-I, --ignore-formatting
Ignore formatting changes such as bold or underline markup.-d chars, --delimiters=chars
Characters to treat as word delimiters.-P, --punctuation
Use punctuation characters as delimiters.-W chars, --white-space=chars
Characters to treat as whitespace.-1, --no-deleted
Suppress words deleted from the first file.-2, --no-inserted
Suppress words inserted in the second file.-3, --no-common
Suppress words common to both files, leaving only the changes.-C num, --context=num
Show num lines of context around each change.-A algo, --algorithm=algo
Comparison algorithm: best, normal or fast.-w string, --start-delete=string
String marking the start of deleted text (default `[-`).-x string, --stop-delete=string
String marking the end of deleted text (default `-]`).-y string, --start-insert=string
String marking the start of inserted text (default `{+`).-z string, --stop-insert=string
String marking the end of inserted text (default `+}`).--diff-input
Read unified diff output instead of two files.--wdiff-output
Produce wdiff-compatible output.
OUTPUT FORMAT
INSTALL
CAVEATS
Best suited for prose, not code. Large files may be slow to process. Word boundaries depend on delimiter settings. May need adjustment for non-English text or special characters.
HISTORY
dwdiff was written by G.P. Halkes as an improved alternative to the older wdiff utility. It provides better handling of Unicode, color output, and more flexible word delimiting options.