title: How to run a .awk file?
body: <p>I am converting a <a href="http://en.wikipedia.org/wiki/Comma-separated_values" rel="noreferrer">CSV</a> file into a table format, and I wrote an AWK script and saved it as my.awk. Here is the my script:</p>
  
  <pre><code>#AWK for test
  awk -F , '
      BEGIN {
          aa = 0;
      }
      {
          hdng = "fname,lname,salary,city";
          l1 = length($1);
          l13 = length($13);
          if ((l1 &gt; 2) &amp;&amp;  (l13 == 0)) {
              fname = substr($1, 2, 1);
              l1 = length($3) - 4;
              lname = substr($3, l1, 4);
              processor = substr($1, 2);
              #printf("%s,%s,%s,%s\n", fname, lname, salary, $0);
          }
  
          if ($0 ~ ",,,,")
              aa++
          else if ($0 ~ ",fname")
              printf("%s\n", hdng);
          else if ((l1 &gt; 2) &amp;&amp; (l13 == 0)) {
              a++;
          }
          else {
              perf = $11;
              if (perf ~/^[0-9\.\" ]+$/)
                  type = "num"
              else
                  type = "char";
              if (type == "num")
                  printf("Mr%s,%s,%s,%s,,N,N,,\n", $0,fname,lname, city);
          }
      }
      END {
      } ' &lt; life.csv &gt; life_out.csv*
  </code></pre>
  
  <p>How can I run this script on a Unix server? I tried to run this my.awk file by using this command:</p>
  
  <pre><code>awk -f my.awk life.csv
  </code></pre>