in reply to Re^4: how to count route diffs in traceroute outputs
in thread how to count route diffs in traceroute outputs
For that format of diff, any line that starts with '<' comes from the first file, any line that starts with '>' comes from the second file, and all other lines are infrastructure.
The infrastructure comes in three flavours; 4c4,5 means "to minimise differences, I have to replace line 4 in the first file with lines 4-5 in the second file"; you may also see 4,10d3 which means "I have to delete lines 4-10 from the first file (which would have appeared after line 3 in the second file)", or 5a6 which means "I have to add line 6 in the second file, which should have appeared after line 5 in the first file".
For 'a' and 'd' only the added/removed lines are shown; for 'c' the old lines are shown, then the '---' separator, then the new lines.
Note that there are other formats for the diffs that you may see depending on the version and the flags you supply.
At the simplest level, you could just count the number of lines starting with '<' and '>': for your example that would give "2 hops in the first trace were replaced by 3 hops in the second trace", or take the difference to report "the second trace was 1 hop longer" (though you don't need diff to get the latter output).
Hugo
|
|---|