Hi all,
I wanted to do a lookup table method using awk or any other commands. I would really appreciate any help on this. my sample input and desired outputs are given below. file1.txt is my lookuptable file, file2.txt, is the main file.
file1.txt
NaN NaN
33.5 0.00000000000000
33.51 0.041351
33.52 0.082702
33.53 0.124053
33.54 0.165404
33.55 0.206755
33.56 0.248106
33.57 0.289457
33.58 0.330808
33.59 0.372159
33.6 0.41351002500000
file2.txt
33.00
33.56
33.57
NaN
NaN
33.50
33.60
33.54
NaN
33.71
33.90
desired output
33.00 0.00000000000000 ; 33 < 33.5
33.56 0.041351
33.57 0.289457
NaN NaN
NaN NaN
33.50 0.00000000000000
33.60 0.41351002500000
33.54 0.165404
NaN NaN
33.71 0.41351002500000
33.90 0.41351002500000 ; 33.9 > 33.6
If the value in file2.txt is lower than that of the minimum in file1.txt, then it will use the corresponding value of the minimum in file1.txt and will use the maximum value in file2.txt, if it is otherwise.