Comparing two columns in different file and printing match if difference between record in a columns less than or equal to 0.001
<p>I have two text files, say file1.txt contains something like </p>

<pre><code>100.145 10.0728
100.298 10.04
100.212 10.0286
</code></pre>

<p>and file2.txt contains something like </p>

<pre><code>100.223 8.92739
100.209 9.04269
100.084 9.08411
</code></pre>

<p>I want to compare column 1 and column 2 of both files and print match
if the difference of both columns in file1.txt and in file2.txt is less or equal to 0.001.</p>

<p>I would use <code>paste</code> to combine the files and then let <code>awk</code> do the rest:</p>

<pre><code>paste file1.txt file2.txt |
awk '
  function abs(v) {return v &lt; 0 ? -v : v}
  abs($1-$3) &lt;= lim &amp;&amp; abs($2-$4) &lt;= lim
' lim=0.001
</code></pre>

<p><code>abs</code> function definition copied from <a href="http://unix.stackexchange.com/a/220590/17666">an answer by StÃ©phane Chazelas</a></p>

python awk