Colored DIFF to HTML

Colorize your diff and save the colorized output HTML for non shell users 😉

Required tools:

  • diff
  • colordiff
  • Script ansi2html.sh

Install colordiff

sudo apt install colordiff

Get ansi2html.sh

wget https://github.com/lanbugs/scripts/blob/master/scripts/ansi2html.sh
chmod 700 ansi2html.sh

Make a colorized diff

diff -bur core1.txt core2.txt | colordiff

You should see a colorized diff on the shell

Now let convert the ansi colored output to HTML …

diff -bur core1.txt core2.txt | colordiff | ./ansi2html.sh > /mnt/c/temp/diff.html

The ansi2html.sh script now created an HTML file which you can open in the browser now.

Schreibe einen Kommentar

This site uses Akismet to reduce spam. Learn how your comment data is processed.