Solved

Linux shell diff utility with highlite

Posted on 2010-08-20
7
465 Views
Last Modified: 2013-12-26
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.
0
Comment
Question by:pmsguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 6

Assisted Solution

by:jghelfman40
jghelfman40 earned 300 total points
ID: 33487430
I don't believe that is possible, however if you used a gui tool like 'meld' that would be.

http://meld.sourceforge.net/

On it not being possible, after a quick google search I found this site that uses a hilight tool with diff:
http://www.debian-administration.org/articles/464
0
 
LVL 13

Assisted Solution

by:Superdave
Superdave earned 100 total points
ID: 33487596
Vim will also do that for you (with -d option or invoked as vimdiff)
0
 

Author Comment

by:pmsguy
ID: 33487914
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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Assisted Solution

by:jghelfman40
jghelfman40 earned 300 total points
ID: 33489590
To the author:


Did you look at the debian url I had posted? That is what it does.
0
 

Author Comment

by:pmsguy
ID: 33511075
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.
0
 
LVL 2

Accepted Solution

by:
tmarques1000 earned 100 total points
ID: 33515896
Try colordiff  http://colordiff.sourceforge.net/

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

Try hidiff too: http://www.perlmonks.org/?node_id=648150
(need curses for perl, on debian: libcurses-perl)

hidiff orig new
0
 
LVL 6

Assisted Solution

by:jghelfman40
jghelfman40 earned 300 total points
ID: 33532583
My first comment with the url does exactly that. Pipe through something to stdout.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question