csvdiff is a perl script to compare/diff two (comma) separated files with each other. The part that is different to standard diff is, that you'll get the number of the record where the difference occurs and the field/column which is different.
The separator can be set to the value you want it to, not just comma. Also you can to provide a third file which contains the columnnames in one(!) line separated by your separator. If you do so, columnnames are shown if a difference is found.
I wrote csvdiff to compare two database unloadfiles, but you can use it for any kind of file which has separators.
Here are some key features of "csvdiff German Docs":
· Choosable field separator
· If you provide a file containing the fieldnames, csvdiff tells you (by name) in which field a difference occured
· Multiple column key
· Ignor upper/lower case
· Trim leading/tailing spaces
· fade out selectet columns for comparision, usefull for columns with timestamps or columns which are not interesting for you
· Sort data befor comparing it, this has only effect if for comparision without key(s)
· Ignore empty lines while importing data files
· Second output format, looks a bit like diff, but with colour
· Data::Dumper, deactivated just needed for debugging
perl csvdiff.pl -a Actual-Result -e Expectedt-Result -s ";" -c Columnames -t -i -k 2
Parameters: -e File1 Expected Result
-a File2 Actual Result
-c File3 Columnames in csv format (in one Line!), optional
-k Keycolumn(s) Keycolumn(s), optional (separatet by the same separator used for data)
count starts with 1, if you want to use multiple keys do like "3,1"
which meens the third and the first colums together are the unique key
-s Separator Fieldseparator, optional (default=,)
-t Trim leading and tailing blanks, optional
-v Print csvdiff version and quit
-g Grade/sort data before comparision, this has only effect when there are no key column
-i Ignor upper and lower case, optional
-f Fade out column(s) for compare, optional
-h Help, optional
-d coloured Output which looks like diff
-D Debug, optional