slackware:cdiff
This is an old revision of the document!
Paste the following into .bashrc (from Paul Warren):
- cdiff.txt
# cdiff: coloured diff format # # Paul Warren <pdw@ex-parrot.com> # 12/01/2001 # Licensed under the GPL # 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='%<%>' \ --new-group-format='%>' \ --old-group-format='%<' \ --new-line-format='${diffnew}+ %l $reset' \ --old-line-format='${diffold}- %l $reset' \ --unchanged-line-format='${diffsame} %l${reset} ' "
If piping into less, use “less -r” or “less -R”. Want to compare MS Word files in colour? Tack on:
- docdiff.txt
# compare word files in colour function docdiff { cdiff <(antiword "$1") <(antiword "$2") | less -r }
slackware/cdiff.1335885314.txt.gz · Last modified: 2019/11/07 17:58 (external edit)