title: A further question about calculating average "distance" between the corresponding content in two files
body: <p>Now my program generates two data files. a.txt and b.txt
  Take a.txt as an example, it's content just like this:</p>
  
  <pre><code>0,0
  0,1
  1,0
  -3,1
  1,-2
  1,3
  ......
  </code></pre>
  
  <p>b.txt is similar with a.txt.  </p>
  
  <p>Now, I hope to find out average distance between the corresponding content in a and b file.
  In other words, for example, if b.txt like this:</p>
  
  <pre><code>0,0
  1,1
  1,2
  -3,1
  1,-2
  1,3
  ......
  </code></pre>
  
  <p>Then the distance is calculated in this way:</p>
  
  <pre><code>  sqrt[square(0-0)+square(0-0)]
      +sqrt[square(0-1)+square(1-1)]
      +sqrt[square(1-1)+square(0-2)]
      +sqrt[square((-3)-(-3))+square(1-1)]
      +sqrt[square(1-1)+square((-2)-(-2))]
      .......
     _____________
     /Total number(i.e 10,000)
  </code></pre>
  
  <p>to get the average distance between these two files content.</p>
  
  <p>Question: how to write a shell script which can carry out the calculation process like above? And output the final average distance?</p>
  
  <p>Hint: you may view two groups of coordinates are stored in two files.</p>
  
  <p>Need your kind help..Many many Thanks.</p>
  
  <p><strong>Addition:</strong>
  There are about 10,000 - 100,000 rows for each files.</p>