Your solution almost got what I wanted. The only thing is that the code needs to check if the order is same too. I think I missed adding that in my original thread
e.g: t1.txt
a,b
t2.txt
b,a
It should tell that files are different and why
Maybe I should do a cksum first and then if different, check if it is different because of order, different because field name is different or extra field.