title: subtract column from another column in a file and replace the column by subtracted result
body: <p>Among thousands of files, for example I have a file say 'corr0.txt' like:</p>
  
  <pre><code>1 1 1 1 1 1 2.559346e-08 2.080054e-10
  1 1 1 1 1 2 1.398551e-09 2.709745e-09
  1 1 1 1 1 3 -7.939651e-10 -1.560374e-09
  1 1 1 1 1 4 -4.734811e-09 -1.031029e-09
  1 1 1 1 1 5 -7.906407e-10 -1.264427e-09
  1 1 1 1 1 6 1.143652e-09 -1.662138e-09
  1 1 1 1 1 7 -1.843946e-09 -2.157429e-09
  1 1 1 1 1 8 -5.101709e-11 -3.662005e-10
  </code></pre>
  
  <p>Now I have another file "avg.txt" which is like:</p>
  
  <pre><code>2.13819e-08
  -3.29974e-10
  -9.25384e-10
  -2.3519e-10
  -9.54804e-10
  -6.87923e-10
  2.34904e-10
  1.25694e-10
  </code></pre>
  
  <p>To subtract the column of 'avg.txt' from the 7th column of 'corr0.txt', I write awk command:</p>
  
  <pre><code>awk 'FNR==NR {arr[NR]=$1; next} { print $7-arr[FNR]}'  avg.txt corr0.txt
  </code></pre>
  
  <p>Now if I want to replace the 7th column of the 'corr0.txt' file with the subtracted result and write the output in a file, how should I modify the command? Thanks for your help. </p>