Basic MySQL. XOR?

Seth Gordon sethg at ropine.com
Mon Oct 30 10:13:33 EST 2006


Tom Metro wrote:
> Dwight E Chadbourne wrote:
> 
>> Two people are handing me CSV files and I don't care about what they
>> agree on.
> 
> 
> If you want to see differences at the record (line) level, try:
> 
> % diff --old-line-format=%L --new-line-format=%L
> --unchanged-line-format="" data1.csv data2.csv > diff.csv
> 
> diff.csv should end up with none of the lines that are identical in the
> two source files, and only contain the lines that differ.

Or this:

comm -23 data1.csv data2.csv > unique1.csv
comm -13 data1.csv data2.csv > unique2.csv
cat unique1.csv unique2.csv

I think both the diff-based solution and the comm-based solution require
the files to be sorted; the catch is that in this brave new world of
Unicode and locales, a file that is "sorted" by one utility may not be
recognized as "sorted" by another.  So sanity-check your output.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Discuss mailing list