Search Results

Search: Posts Made By: Scrutinizer
2,303
Posted By Scrutinizer
Hi, you could for example give every intermediate...
Hi, you could for example give every intermediate value the value of the previous known value:
awk 'NR==FNR{if(!i)i=$1; while(i<=$1)A[i++]=$2;next} {print A[int($1+.5)]}' fileB.txt fileA.txt
2,303
Posted By Scrutinizer
It is because for some entries in fileA there is...
It is because for some entries in fileA there is no match in fileB and then those lines do not get printed. If you would use:
awk 'NR==FNR{A[$1]=$2;next} {i=int($1+.5);print A[i]}' file2 file1Those...
2,303
Posted By Scrutinizer
You need to flip file1 and file2 around. try: ...
You need to flip file1 and file2 around. try:
awk 'NR==FNR{A[$1]=$2;next} {i=int($1+.5)} i in A {print A[i]}' file2 file1
Showing results 1 to 3 of 3

 
All times are GMT -4. The time now is 02:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy