title: Understanding how gnuplot uses awk scripts
body: <p>I have a data file</p>
  <p><code>data.txt</code></p>
  <pre><code>1 1
  2 2
  3 3
  5 4
  7 5
  </code></pre>
  <p>and I am trying to understand how to gnuplot uses awk.  I can plot it with <code>plot &quot;&lt;awk '{print $1,$2}' data.txt&quot;</code>.  However, when I try <code>load '&lt;./script.sh data.txt'</code> it does not work.</p>
  <p><code>script.sh</code></p>
  <pre><code>#!/bin/bash
  awk 'BEGIN {
           printf &quot;plot &quot;;
      }
      {
          printf &quot;%i %i\n&quot;,$1,$2
      }
      
  ' $1
  </code></pre>
  <p>Using the <code>script.sh</code> method returns the error :</p>
  <blockquote>
  <p>gnuplot&gt; plot 1 1</p>
  <pre><code>              ^
  </code></pre>
  <p>&quot;&lt;./script.sh data.txt&quot;, line 1: unexpected or unrecognized token</p>
  </blockquote>
  <p>It seems to me that my awk script is the functional equivalent of the inline awk statement.  Why doesn't the <code>script.sh</code> method work?</p>
  <p>FYI, I am aware that I can just do <code>plot &quot;data.txt&quot; u 1:2</code> to plot my data.  This is just an idealized version of a more complex problem that I am trying to solve.</p>