I am trying to get out put like following...if col3 value of B.txt is greater than col3 of A.txt then corresponding col1 and difference between the col3 values.
Thanks yinyuemi and pflynn !! Both solutions work !!
pflynn , Yes you are right, I was doing wrong in defining the array....I thought it will yield me just the col3 value when I compare...but I suppose it was taking whole row and trying to compare...
do you guys explain this part of code , { arr[$1]=$3 } ?
What we are doing here is creating an array, whose indexes are the contents of the first column of each line ("abc", "xyz", etc), and the values are the corresponding third element of each line. For example, the first element of the array is arr[abc], whose value is 5. Notice that this operation is done when we are reading file A.txt. After we are done reading A.txt, we start reading file B.txt, then we can use column 1 (element $1) of each line as index to retrieve back the corresponding third column of file A.txt from the array, and compare it to the current element from the trhird column ($3). If they are different, we print them.