#!/bin/sh # The -3 option to wdiff gives no context, so I'm getting wdiff to spit out the # whole document and using grep to trim it down. The regex for grep could be # improved, but for text documents is probably ok, and at worst will include # some extra output that can be ignored.. # # Iain Murray, February 2009 if [ "$#" -lt 2 ] ; then echo 'Usage: cwdiff FILE1 FILE2' echo ' cwdiff [any options will be discarded] FILE1 FILE2' exit fi # Discard any options, for example SVN attempts to set a bunch of GNU diff # options shift $(($# - 2)) wdiff -n "$1" "$2" | grep -C2 '[{[][-+].*[-+][]}]' | colordiff