Hi,
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
File2
SR.no COL1 COL2 COL3
10536 6051457 Sb 249
10537 10983989 Sb 149.97
10538 8222030 Sb 59
10530 15120599 Sb 69.97
10531 21635123 Sb 149.99
10532 8477371 Sb 126.44
10533 14526541 Sb 67.09
10534 10993779 Sb 99
10535 15684120 Sb 112.99
10527 14150524 Sb 37.88
10528 12311440 Sb 0
10529 12441731 Sb 111.66
10539 10910428 Sb 237.2
10540 9854892 Sb 27.54
Result
SR.no COL1 COL2 COL3 COL4
10527 14150524 Sa 39.88 0
10528 12311440 Sa 0 0
10529 12441731 Sa 111.66 0
10530 15120599 Sa 69.97 0
10531 21635123 Sa 149.99 0
10532 9854892 Sa 27.53 -98.91
10533 14526541 Sa 67.06 -0.03
10534 10993779 Sa 99 0
10535 15684120 Sa 112.99 0
10536 6051457 Sa 249 0
10537 10983989 Sa 149.97 0
10538 8222030 Sa 59 0
10539 10910428 Sa 237.2 0
10540 8477371 Sa 126.44 98.9