Solved

Linux shell diff utility with highlite

Posted on 2010-08-20
7
454 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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.

810 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