title: Output sar command results to a csv file
body: <p>I'm relatively new to shell programming and would like to know if there is a simple way to output the results of the <code>sar</code> command to a <code>csv</code> file. Using <code>sar &gt; file1.csv</code> does the job, but it is not properly formatted. All the data is present in one column. I tried this, but it was worse </p>
  
  <pre><code>sar -d -u -w 1 1 | grep -v Average | grep -v Linux | tr -s ' ' ',' | tr -d '\n' &gt; file1.csv
  </code></pre>
  
  <p>Can anyone give me the right script to store the output of the <code>sar</code> command in a <code>csv</code> file. Help will be appreciated. </p>