3

I'm comparing two files using sdiff to get side by side difference but I want the difference to be color highlighted.
Ex:
File A:
Hello There! General Kenobi!
Magic

File B:
Hello World! Hola
Magic

Now the output from sdiff will be:
Hello There! General Kenobi! | Hello World! Hola

I want the diff highlighted like (couldn't color code so, bold and italics)
Hello There! General Kenobi! | Hello World! Hola

I can't use GUI based or colordiff command etc. I tried using sed and last option is to pipe the sdiff output through a script, but I'm thinking there might be a better way.

manly
  • 49
  • 3
  • 1
    this might help: https://stackoverflow.com/questions/8800578/how-to-colorize-diff-on-the-command-line – Sundeep Jan 23 '19 at 10:36
  • I've already gone through that and it wasn't much helpful as I can't use many of the mentioned commands and even --color option of diff. – manly Jan 23 '19 at 11:05
  • Does this answer your question? [How to colorize diff on the command line?](https://stackoverflow.com/questions/8800578/how-to-colorize-diff-on-the-command-line) – smci Apr 15 '21 at 19:01

2 Answers2

0

csdiff is a small wrapper script to colorize the output of sdiff.

It works well for colorizing the side-by-side diff, but it doesn't work with sdiff's interactive mode (-o).

You can also just use diff --color=always --side-by-side for similar results, or icdiff.

Dario Seidl
  • 4,140
  • 1
  • 39
  • 55
-1

The emacs command ediff-buffers produces colourised output. But you have to be using emacs :-)

wef
  • 351
  • 3
  • 12