Solved

Linux shell diff utility with highlite

Posted on 2010-08-20
7
456 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
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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

809 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