1828490 Members
2554 Online
109978 Solutions
New Discussion

Do we have a wiser diff?

 
SOLVED
Go to solution
arking1981
Frequent Advisor

Do we have a wiser diff?

Hi dears,

 

Do we have a wiser diff?

I want to compare two csv files and analyze the change to get what is added, deleted and modified. For example:


File1:

2,2,0,0030D303FE82,s002c02p0,10.87.134.222,acceSS7
2,2,1,0030D303FE50,s002c02p1,10.87.134.223,acceSS7
2,2,2,0030D300372E,s002c02p2,10.87.134.224,acceSS7
2,2,3,0030D300372D,s002c02p3,10.87.134.225,acceSS7
2,2,4,0030D300372A,s002c02p4,10.87.134.226,acceSS7
2,2,5,0030D300372B,s002c02p5,10.87.134.227,acceSS7

File2:

2,2,1,0030D303FE50,s002c02p1,10.87.134.223,acceSS7
2,2,2,0030D300372E,s002c02p2,10.87.134.224,acceSS7
2,2,3,0030D300372D,s002c02p3,10.87.134.225,acceSS7
2,4,0,0800FFFFFFFF,s002c04p0,0.0.0.0,acceSS7
2,5,0,0800FFFFFFFF,s002c05p0,0.0.0.0,acceSS7

 

diff file1 file2

2d1
< 2,2,0,0030D303FE82,s002c02p0,10.87.134.222,acceSS7
6,7c5,6
< 2,2,4,0030D300372A,s002c02p4,10.87.134.226,acceSS7
< 2,2,5,0030D300372B,s002c02p5,10.87.134.227,acceSS7
---
> 2,4,0,0800FFFFFFFF,s002c04p0,0.0.0.0,acceSS7
> 2,5,0,0800FFFFFFFF,s002c05p0,0.0.0.0,acceSS7

 

The first change is simple and diff is right. The second change is actually a deletion combined with an addition but diff can only tell it as a modification.


Any chance we have such a tool diff to tell what I want or another tool can do? Please advise.

Apologize for asking a stupid question and thanks a lot for your time.

 

Regards

Kang


 

Hello world...
3 REPLIES 3
Dennis Handly
Acclaimed Contributor
Solution

Re: Do we have a wiser diff?

What do you consider the a change vs. a delete then add?  diff(1) doesn't know the difference.

 

I supose you could take the output from diff and modify it to your needs.

arking1981
Frequent Advisor

Re: Do we have a wiser diff?

indeed it is true.
Hello world...
Rajesh K Chaurasia
Valued Contributor

Re: Do we have a wiser diff?

If not for command line tool, you may consider tkdiff or beyond compare (may need to recompile on HP-UX).