title: adding variable to column entries awk
body: <p>I want to give a value from a file read to a variable, then use it to modify all elements of a column in another file, specifically to shift the entries by some number. </p>
  
  <p>The data file "file_to_change" has two columns of numerical data, one to be shifted in value. Like so:</p>
  
  <pre><code>-1.643465E+01    1.378835E-03
  -1.642464E+01    1.242392E-03
  -1.641463E+01    1.147501E-03
  -1.640462E+01    1.083067E-03
  -1.639461E+01    1.042069E-03
  -1.638460E+01    1.020041E-03
  -1.637459E+01    1.014211E-03
  </code></pre>
  
  <p>The file "tmp" which contains the shifting value is simply this:</p>
  
  <pre><code>-11.43465
  </code></pre>
  
  <p>I current have the following code:</p>
  
  <pre><code>file=tmp
  var1=$(awk 'NR==1' $file)
  
  echo $var1
  
  awk '{print ($1 - $var1) " " $2}' file_to_change
  
  echo $var1
  </code></pre>
  
  <p>My result is:</p>
  
  <pre><code>   -11.43465
     0 1.378835E-03
     0 1.242392E-03
     0 1.147501E-03
     0 1.083067E-03
     0 1.042069E-03
     0 1.020041E-03
     0 1.014211E-03
     -11.43465
  </code></pre>
  
  <p>I imagine this is pretty straightforward, but I can't see where the error is!</p>