from the awk command i'm getting the output where the 2nd column of both are match in row wise,
if it present in that same column some where else, I cannot get the correct output.
awk 'FNR==NR {a[$1]=$5;next} $1 in a {if ($5==a[$1]) t=0; else {t=$5-a[$1]};print $0,t}' file.tsv file2.tsv
here i have given the input files and output files, and awk command
awk 'FNR==NR {a[$1]=$4;next} $1 in a {if ($4==a[$1]) t=0; else {t=$4-a[$1]};print $0,t}' file1.tsv file2.tsv
i have to find the COL1 number in file2 and get the difference of the matched number's COL3 Value that is i have to find the 14150524 in file2 and take a difference of 39.88 - 37.88 and the result i want is like 10527 14150524 Sa 39.88 -2
File 1
SR.no COL1 COL2 COL3
10527 14150524 Sa 39.88
10528 12311440 Sa 0
10529 12441731 Sa 111.66
10530 15120599 Sa 69.97
10531 21635123 Sa 149.99
10532 9854892 Sa 27.53
10533 14526541 Sa 67.06
10534 10993779 Sa 99
10535 15684120 Sa 112.99
10536 6051457 Sa 249
10537 10983989 Sa 149.97
10538 8222030 Sa 59
10539 10910428 Sa 237.2
10540 8477371 Sa 126.44