When you said:

first value of file1 should compare should through entire first column of file2.

Did you mean something like this:

Print lines in file 1 where the first word on the line is not found in file2; also print lines in file 2 where the first word on the line is not found in file1.

Or did you mean something different? You might want to look at a tool I posted here a few years ago: cmpcol. If I understand your task, you would get the results you want running that script like this:

cmpcol -x file1 file2 > file.diffs
For lines where the initial column is unique (eXclusive) to one input file or the other, the value of the first column will be printed to STDOUT (which you can redirect to a third file). The output indicates which input file ("1" or "2") each unique value came from.

If you want to see the whole content of each line from file1 that begins with a name not found in file2, run it like this:

cmpcol -x1 -l1 file1 file2 > in-file1-only
and you can do likewise for lines unique to file2:
cmpcol -x2 -l2 file1 file2 > in-file2-only
You can also output the "intersection" (-i) or the "union" (-u) for the two files, instead of the "exclusive" (-x) content.

In reply to Re: Need code for comparing by graff
in thread Need code for comparing by idy

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.