TL;DR
The 8 most useful dwdiff
invocations for ASCII + CJK. Copy-pasteable.
The essentials
Word diff (ASCII): show which words changed between two files
$ dwdiff old.txt new.txt
the [-quick-]{+slow+} brown fox
jumps over the [-lazy-]{+sleepy+} dog
CJK word diff (the differentiator vs stock wdiff):
$ printf '体育老师无奈,总被佔课现象\n' > a.txt
$ printf '体育老师无奈,总被占课现象\n' > b.txt
$ dwdiff -d ',' a.txt b.txt
体育老师无奈,[-总被佔课现象-]{+总被占课现象-}
Treat ALL Unicode punctuation as delimiters
$ dwdiff -P old.txt new.txt
Add custom whitespace characters (e.g. CJK ideographic space)
$ dwdiff -w $' \t\n ' old.txt new.txt # U+3000 = ideographic space
Show only the inserted / deleted words (no common text)
$ dwdiff -1 old.txt new.txt # only deletes
$ dwdiff -2 old.txt new.txt # only inserts
$ dwdiff -3 old.txt new.txt # only common (inverts the question)
Diff algorithms
Use the minimal-edit-cost algorithm (default is greedy)
$ dwdiff -A minimal old.txt new.txt
Use the patience algorithm (better on big files with repeated blocks)
$ dwdiff -A patience old.txt new.txt
Myers' O(ND) algorithm (best for very similar files)
$ dwdiff -A myers old.txt new.txt
Scripts, CI, and pipelines
Re-format a unified diff at the word level (read from stdin)
$ git diff | dwdiff --diff-input
Quiet mode: exit 0/1 only, no output (for shell scripts)
$ dwdiff -q old.txt new.txt && echo same || echo different
Statistics to stderr (word counts + change breakdown)
$ dwdiff -s old.txt new.txt
old: 7 words
new: 7 words 6 86% common 1 14% deleted 0 0% changed
Unicode extras (powered by bundled ICU 78.3)
Case-fold while comparing (handles Turkish dotted-i, German sharp-s, etc.)
$ dwdiff -i Straße.txt STRASSE.txt
Read from stdin when one file is given as '-'
$ echo 'Hello, World!' | dwdiff - - <<< 'Hello, 世界!'
Hello, [-World!-]{+世界!}
When NOT to use dwdiff
If your input is plain ASCII English and you don't need
CJK or Unicode segmentation, wdiff
is faster and the binary is ~600x smaller (72 KB vs
34 MB). dwdiff's 34 MB static binary is the
cost of embedded ICU 78.3; pay it only when you need
CJK / Unicode-segmentation features.