Hi,
I have 2 files, I need to use column of file1 and do a comparison on file2 column 1 and print the mismatch is file3 as mentioned below.
Kindly consider that file 1 is having uniq key(column) whereas in file2 we have multiple duplicates (like 44). These duplicates should not come in output of file 3 but should be routed to a new file4.
file1:
1,apple
2,mango
3,banana
44,orange
file2:
1,apple
22,
31,xyz
2,man
3,banana
44,oran
44,orange
The expected output to file file3 :-
2,mango,man
and in file4 we should capture duplicates :-
44,oran
44,orange
Through different forum i got the cmd as {
awk 'BEGIN{FS=OFS=","}($1 in a) && a[$1]!=$2{print $1,a[$1],$2}{a[$1]=$2}' file1 file2 >> file3
}
for file 3 generation but it is not working fine with duplicates.