Comparing Tables with ExamDiff Pro |
Did you know that you can use ExamDiff Pro to compare tabular data? Let's take a look at an example.
Let's say that I want to compare two comma-separated files that represent tabular data dumps from a database. The data came form the same table but it was sorted differently when each CSV file was created. The two sample files are available here. Our first attempt to compare these files with ExamDiff Pro is not very useful (click the images to enlarge):
There are too many differences shown, because the two files have been sorted differently. Fortunately, we can use a plug-in to sort the data by its primary key, in this case by the first column. We are going to use the xsv command line tool, which, among its other features, can sort CSV files by a given column.
To set up xsv as an ExamDiff Pro plug-in, download the latest version here, unzip it, and then set it up in ExamDiff Pro as follows (with the appropriate path to xsv.exe in the Application line):
Note the syntax: sort -s 1 -N. The -s 1 flag specifies that the we want to sort the data by the first column, and the -N flag indicates that it to be treated as numeric data. The results of using this plug-in are better but still not that useful:
The problem is the ModifiedDate column: it's completely different between these files, and that causes each row to be marked as a changed line. What if we don't care about this column? In this case, let's ignore it in the Options:
After clicking OK here's what we get:
Now this is something we can definitely use!
Let's say that I want to compare two comma-separated files that represent tabular data dumps from a database. The data came form the same table but it was sorted differently when each CSV file was created. The two sample files are available here. Our first attempt to compare these files with ExamDiff Pro is not very useful (click the images to enlarge):
There are too many differences shown, because the two files have been sorted differently. Fortunately, we can use a plug-in to sort the data by its primary key, in this case by the first column. We are going to use the xsv command line tool, which, among its other features, can sort CSV files by a given column.
To set up xsv as an ExamDiff Pro plug-in, download the latest version here, unzip it, and then set it up in ExamDiff Pro as follows (with the appropriate path to xsv.exe in the Application line):
Note the syntax: sort -s 1 -N. The -s 1 flag specifies that the we want to sort the data by the first column, and the -N flag indicates that it to be treated as numeric data. The results of using this plug-in are better but still not that useful:
The problem is the ModifiedDate column: it's completely different between these files, and that causes each row to be marked as a changed line. What if we don't care about this column? In this case, let's ignore it in the Options:
After clicking OK here's what we get:
Now this is something we can definitely use!
Labels: ExamDiff Pro