cdiff is shell alias to do colored diffs.
Version: 0.1cdiff is shell alias to do colored diffs.
Operating System: Linux
This is a simple bash alias to give color-coded differences between two files. I originally wrote it for viewing the differences between XML files where it is desirable to be able to find the changes quickly but to view a large amount of context either side, but I now use it for viewing differences between all kinds of files.
(For the benefit of U.S. users of search engines, I will now point out that cdiff produces colored diffs. It uses the diff utility and has colors).
Simply source cdiff into your shell. This is best achieved by copying it into .bashrc . The output of cdiff can be viewed by piping into less -R or less -r. The -R is needed to handle the colour codes.
Get cdiff or cut and paste it:
# cdiff: coloured diff format
# Paul Warren
# colour for added lines (bright yellow)
diffnew=`tput setf 6``tput bold`
# colour for removed lines (bright red)
diffold=`tput setf 4``tput bold`
# colour for unchanged lines (bright black, aka dark grey)
diffsame=`tput setf 0``tput bold`
# reset - original pair, unset all attributes
reset=`tput op``tput sgr0`
alias cdiff="diff --changed-group-format='%'