title: gnuplot awk/bash escaping quoting
body: <p>UPDATED:</p>
  
  <p>I have this awk command I want to nest into a system("") command.
  <code>awk ' BEGIN {yr=2016} !/^#/ &amp;&amp; NF!=0 { for(i=2;i&lt;=NF;i++) a[i]+=$i } END { for (y=2;y&lt;=NF;y++) print yr++ " - (" a[y] " Loads)" }' vol.dat</code></p>
  
  <p>so I tried this:
  <code>system("awk ' BEGIN {yr=2016} !/^#/ &amp;&amp; NF!=0 { for(i=2;i&lt;=NF;i++) a[i]+=$i } END { for (y=2;y&lt;=NF;y++) print yr++ \" - (\" a[y] \" Loads)\" }' vol.dat")</code></p>
  
  <p>Bash does not like it due to the nesting and I am obviously not escaping the quotes correctly. However I try to escape the characters I can not get it to print with a space.</p>
  
  <p>Here is some sample input, but as I said it is not an awk problem it is an issue with the awk command being nested in double quotes and escape characters:</p>
  
  <pre><code>vol.dat
  Jan 0   165 165 228 78  
  Feb 10  52  149 196 79  
  Mar 46  186 159 137 182
  
  Output:
  2016 (56 Loads)
  2017 (403 Loads)
  2018 (473 Loads)
  2019 (561 Loads)
  2020 (339 Loads)
  
  </code></pre>