title: C, pass AWK syntax as argument to execl
body: <p>I want to run the following command from a C program to read the system's CPU and memory use:</p>
  
  <pre><code>ps aux|awk 'NR &gt; 0 { cpu +=$3; ram+=$4 }; END {print cpu,ram}'
  </code></pre>
  
  <p>I am trying to pass it to the <code>execl</code> command and after that read its output:</p>
  
  <pre><code>execl("/bin/ps", "/bin/ps", "aux|awk", "'NR &gt; 0 { cpu +=$3; ram+=$4 }; END {print cpu,ram}'",(char *) 0);
  </code></pre>
  
  <p>But in the terminal I am getting the following error:</p>
  
  <blockquote>
    <p>ERROR: Unsupported option (BSD syntax)</p>
  </blockquote>
  
  <p>I would like to know how to properly pass awk as argument to <code>execl</code>?</p>