title: Using Linux awk command in php
body: <p>Good Day All
  I'm having a problem getting this command to work on button press
  I need to search through a file and output the results in comma delimited text.
  PHP doesnt seem to like the curly brackets so as far as I could read I need to use exec(), but to no avail as the error I recieve is "syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$'"
  I'm still new to php so sorry if the answer is obvious!
  Any info will be helpful, Thanks</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;h1&gt;Linux Command Test&lt;/h1&gt;
  
  &lt;form method="POST" action=""&gt;
  &lt;input type="submit" id="submit" name="submit" value="Submit"/&gt;
  &lt;/form&gt;
  
  &lt;?php
   if (isset($_POST['submit']))
    {
       $output = exec('grep -i hello test.txt | awk -v OFS=, '{\$1=\$1;print}' &gt; newtest.txt');
       echo "&lt;pre&gt;$output&lt;/pre&gt;";
    }
   ?&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>