Solved

Linux shell diff utility with highlite

Posted on 2010-08-20
7
460 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
RHEL6 + dockers - No route to host 7 99
FTP Script 25 91
WMIC Output Formatting 1 83
How to fix Dual Server Conflict GitLab vs Apache2 3 57
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
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 …
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…
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.
Suggested Courses

737 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