join(1) is your friend.

Let's take for example

[am]king ~/a/tm$ cat first.csv apple,5 pear,4 ananas,6 watermelon,10 salad,5 carrot,6 peach,5 apricot,7 [am]king ~/a/tm$ cat second.csv peach,orange watermelon,green ananas,yellow,expensive apple,red banana,yellow apple,red pea,brown apricot,orange pear,yellow spinach,green salad,green
Then we have to sort them and use join to find the lines found only in the first or only in the second file:
[am]king ~/a/tm$ sort first.csv > first.s [am]king ~/a/tm$ sort second.csv > second.s [am]king ~/a/tm$ join -v1 -t, first.s second.s carrot,6 [am]king ~/a/tm$ join -v2 -t, first.s second.s banana,yellow pea,brown spinach,green

Update 2009 sep 2.

See Re^2: Joining two files on common field for a list of other nodes where unix textutils is suggested to merge files.


In reply to Re: File comparison by ambrus
in thread File comparison by xspikx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.