File a.txt
chr:1:10539:A:C 10539 C A 0.545987 0.508902 0 0.36065 + 1
chr:2:13494:A:G 13494 A G 0.330493 0.0264746 0 0.733423 + 1
chr:7:13494:A:G 13494 A G 0.330493 0.0264746 0 0.733423 + 1
File b.txt
1 4972
2 4972
3 4972
7 4970
I am looking for a way to find partial match between $1
of a.txt
and $1
b.txt
and replace $7
in a.txt
with corresponding $2
from b.txt
.
So that output will look like
chr:1:10539:A:C 10539 C A 0.545987 0.508902 4972 0.36065 + 1
chr:2:13494:A:G 13494 A G 0.330493 0.0264746 4972 0.733423 + 1
chr:7:13494:A:G 13494 A G 0.330493 0.0264746 4970 0.733423 + 1
Thank you for any help.