I have the following two text files:
fruits.txt
nectarine strawberry
orange peach
grape apple
mango watermelon
numbers.txt
strawberry 57
apple 48
mango 40
peach 44
watermelon 60
nectarine 46
orange 72
grape 39
In fruits.txt I want to keep only one of the 2 fruits per line. The one removed should be the one with the higher corresponding number (c.f. numbers.txt). The output would look like:
nectarine
peach
grape
mango
How could I proceed to achieve this in bash?