wdiff usage
This section presents a few examples of usage, most of them have been
contributed by wdiff users.
wdiff -1n old_file new_file |
sed -e 's/^/ /;/{+/s/^ /|/;s/{+//g;s/+}//g'
Here is how it works. Word differences are found, paying attention only
to additions, as requested by option `-1'. For bigger changes
which span line boundaries, the insert bracket strings are repeated on
each output line, as requested by option `-n'. This output is then
reformatted with a sed script which shifts the text right two
columns, turns the initial space into a bar only if there is some new
text on that line, then removes all insert bracket strings.
LaTeX example.
This example has been provided by Steve Fisk,
`fisk@polar.bowdoin.edu'.
The following uses LaTeX to put deleted text in boxes, and new text
in double boxes:
wdiff -w "\fbox{" -x "}" -y "\fbox{\fbox{" -z "}}" ...
works nicely.
troff example.
This example comes from Paul Fox, `pgf@cayman.com'.
Using wdiff, with some troff-specific delimiters gives
much better output. The delimiters I used:
wdiff -w'\s-5' -x'\s0' -y'\fB' -z'\fP' ...This makes the pointsize of deletions 5 points smaller than normal, and emboldens insertions. Fantastic! I experimented with:
wdiff -w'\fI' -x'\fP' -y'\fB' -z'\fP'since that's more like the defaults you use for terminals/printers, but since I actually use italics for emphasis in my documents, I thought the point size thing was clearer. I tried it on code, and it works surprisingly well there, too... Marty Leisner `leisner@eso.mc.xerox.com' says: In the previous example, you had smaller text being taken out and bold face inserted. I had smaller text being taken out and larger text being inserted, I'm using bold face for other things, so this is more clear.
wdiff -w '\s-3' -x'\s0' -y'\s+3' -z'\s0'