Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

showing differences within a line in diff output

Tags:

This StackOverflow answer has an image of KDiff3 highlighting intra-line differences. Does someone know of a tool which can show the same (ex, via color) on the command line?

Another way to think of this is wanting to diff each difference in a patch file.

like image 316
Brian Harris Avatar asked Aug 27 '09 16:08

Brian Harris


People also ask

Which command gives all differences between two files?

diff stands for difference. This command is used to display the differences in the files by comparing the files line by line.

When two files are identical What is the output of diff command?

When two files are identical, what is the output of diff command? Explanation: When two files are identical, diff command does not produce any output. It simply returns the shell prompt $. However, we can use the -s option to display an informative message on the terminal if the files are identical.

What does the command diff do in Unix with respect to files?

On Unix-like operating systems, the diff command analyzes two files and prints the lines that are different. In essence, it outputs a set of instructions for how to change one file to make it identical to the second file.

What is unified diff format?

The unified format (or unidiff) inherits the technical improvements made by the context format, but produces a smaller diff with old and new text presented immediately adjacent. Unified format is usually invoked using the " -u " command line option. This output is often used as input to the patch program.


1 Answers

I don't know if this is sufficiently command line for your purpose, but vimdiff can do this (even does colour). See for example the image in this related question.

like image 100
ire_and_curses Avatar answered Oct 04 '22 21:10

ire_and_curses