Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have two files that I would like to compare in terms of additions and deletions only. For example, if I diff these two files:

start
old
old
old
end

and:

start
old
old but now new
new
new
end

I would get this:

3,4c3,5
< old
< old
---
> old but now new
> new
> new

Rather than the program showing one change, I would like it to show one addition and one deletion. Something like this:

3,4d2
< old
< old
3a3,5
> old but now new
> new
> new

(This probably isn't valid.)

Is is possible to do this with diff, and if not, is there a program that can do it?

share|improve this question
add comment

1 Answer

use the "side by side" feature of diff:

shiny:~ fl$ diff --side-by-side v1 v2
start                           start
old                             old
old                           | old but now new
old                           | new
                              > new
end                             end

other excellent options available in a man page near you: man 1 diff

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.