#!/bin/bash
#                      /usr/local/bin/diff2html
# http://crystalfaeries.net/posix/bin/diff2html
# celeste:crystalfaery 2015-06-19 19:01:00+00:00
# Originally from: 2015-06-19 19:01:00+00:00:
# http://www.commandlinefu.com/commands/view/14319/convert-diff-output-to-html-insdel
#
case $1 in
--version)	tail -n +4 $0 | head -n 1;exit;;
-V)		tail -n +4 $0 | head -n 1;exit;;
-v)		tail -n +4 $0 | head -n 1;exit;;
-h)	echo "$0 diffs two files whose filespecs are given as arguments,"
	echo "and outputs html code to standard output.";exit;;
--help)	echo "$0 diffs two files whose filespecs are given as arguments,"
	echo "and outputs html code to standard output.";exit;;
*)	diff "$1" "$2" | grep -E '^(<|>)' | sed 's:^< \(.*\):<del style="color\:red; text-decoration\: none">- \1</del><br>:' | sed 's:^> \(.*\):<ins style="color\:green; text-decoration\: none">+ \1</ins><br>:';exit;;
esac
exit $?	# how did we get here?


syntax highlighted by Code2HTML, v. 0.9.1