wiki: Artifact [8621a51806]

Not logged in

Artifact 8621a518060944a65e3a76088554a70a8006d08d:

Wiki page [ssdiff] by paulfitz 2010-09-22 20:59:09.
D 2010-09-22T20:59:09
L ssdiff
U paulfitz
W 2686
<h2>ssdiff</h2>

Called as:

  <nowiki><pre>ssdiff --output output.txt original.csv modified.csv</pre></nowiki>

This generates an output describing the changes in modified.csv (compared with original.csv).  This is analogous to a standard [http://en.wikipedia.org/wiki/Diff|diff] file describing differences between text files, but with the following differences:

<ul>
<li>If called with "--format-csv", the output is a valid .csv file, and so can be read and viewed with the same programs used to edit or view the inputs.  In this case, the output is intended to be used to construct the modified spreadsheet from the original using [sspatch] rather than [http://en.wikipedia.org/wiki/Patch_%28Unix%29|patch].</li>
<li>In principle, differences between spreadsheets could be better described than in regular diffs, by exploiting the regularity of spreadsheet structure.  (Whether ssdiff actually achieves this yet is another story).</li>
<li>For some transformations, such as column reordering, a big saving would be possible.</li>
</ul>

<h3>Under development</h3>

The current implementation of ssdiff is just a placeholder, and does the flexibility of ssmerge a disservice.

<h3>Example</h3>

Suppose the original spreadsheet is:

<sheet>
Altitude,Probe A,Probe B,Probe C,Comment
1000,10,20,30,"Wing vibration"
2000,15,25,52,"Wing vibration"
3000,3,66,89,"Ominous silense"
4000,3,42,12,"Ominous silense"
</sheet>

And the modified spreadsheet is:

<sheet>
Altitude,Probe A,Probe B,Probe C,Comment
500,5,10,7,"Smooth flight"
1000,10,20,30,"Wing vibration"
2000,15,25,52,"Wing vibration"
3000,3,66,89,"Ominous silence"
4000,3,42,12,"Ominous silence"
</sheet>

Then output of ssdiff (at the time of writing -- there is lots of potential for improvement so the output is likely to change):

<verbatim>
column names are [0],[1],[2],[3],[4]
insert row with * = 500,5,10,7,"Smooth flight"
for row with [0],[1],[2],[3] = 3000,3,66,89 set [4] = "Ominous silense" -> "Ominous silence"
for row with [0],[1],[2],[3] = 4000,3,42,12 set [4] = "Ominous silense" -> "Ominous silence"
</verbatim>

With the "--format-csv" option, and run through the helper application csv2html, the output is:

<sheet>
[for],0,1,2,3,4,5
[do],select,,,,,
[+++],1+1,500,5,10,7,"Smooth flight"
[-],4,,,,,"Ominous silense"
[+],4,,,,,"Ominous silence"
[-],5,,,,,"Ominous silense"
[+],5,,,,,"Ominous silence"
</sheet>

A regular diff would give:
<verbatim>
1a2
> 500,5,10,7,"Smooth flight"
4,5c5,6
< 3000,3,66,89,"Ominous silense"
< 4000,3,42,12,"Ominous silense"
---
> 3000,3,66,89,"Ominous silence"
> 4000,3,42,12,"Ominous silence"
</verbatim>

Z f8462bb2febfc27b7f7551b90038e148