Linux shell diff utility with highlite

I want to be able the difference with two files and HIGHLIGHT the difference in each line, NOT just the full line

For example, if the diff output is

< This is 123 line
> This is xyz line

I want the 123 and xyz to be highlighted.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

tmarques1000Connect With a Mentor Commented:
Try colordiff

diff -Nau orig new | colordiff
diff orig new | colordiff
colordiff -Nau orig new
colordiff orig new

Try hidiff too:
(need curses for perl, on debian: libcurses-perl)

hidiff orig new
jghelfman40Connect With a Mentor Commented:
I don't believe that is possible, however if you used a gui tool like 'meld' that would be.

On it not being possible, after a quick google search I found this site that uses a hilight tool with diff:
SuperdaveConnect With a Mentor Commented:
Vim will also do that for you (with -d option or invoked as vimdiff)
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

pmsguyAuthor Commented:
Thanks about the vimdiff, I knew that already.

I want to have the diff go to stdout so I can do easy automation via the command line.
jghelfman40Connect With a Mentor Commented:
To the author:

Did you look at the debian url I had posted? That is what it does.
pmsguyAuthor Commented:
The above solutions are good for editors.

However, I want the output to go to stdout and not an editor.

This way I can use a script to see process diffs and pipe to less.

Therefore, I am looking for a script to HIGHLIGHT the diff in the line, not the whole line.

vimdiff does this, but again, I want the output to go to stdout.
jghelfman40Connect With a Mentor Commented:
My first comment with the url does exactly that. Pipe through something to stdout.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.