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. |