title: Use sed or awk to fix date format
body: <p>I'm trying to convert a HTML containing a table to a .csv file using a <code>bash</code> script.</p>
  
  <p>So far I've acomplished the following steps:</p>
  
  <ol>
  <li>Convert to Unix format (with <code>dos2unix</code>)</li>
  <li>Remove all spaces and tabs (with <code>sed 's/[ \t]//g'</code>)</li>
  <li>Remove all the blank lines (with <code>sed ':a;N;$!ba;s/\n//g'</code>) (this is necesary, because the HTML file has a blank line for each cell of the table... that's not my fault)</li>
  <li>Remove the unnecesary <code>&lt;td&gt;</code>  and <code>&lt;tr&gt;</code> tags (with <code>sed 's/&lt;t.&gt;//g'</code>)</li>
  <li>Replace <code>&lt;/td&gt;</code> with ',' (with <code>sed 's/&lt;\/td/,/g'</code>)</li>
  <li>Replace <code>&lt;/tr&gt;</code> with end-of-line (<code>\n</code>) characters (with <code>sed 's/&lt;\/tr/\n/g'</code>)</li>
  </ol>
  
  <p>Of course, I'm putting all this in a pipeline. So far, it's working great. There's one final step I'm stuck with: The table has a column with dates, which has the format <code>dd/mm/yyyy</code>, and I'd like to convert them to <code>yyyy-mm-dd</code>.</p>
  
  <p>Is there a (simple) way to do it (with <code>sed</code> or <code>awk</code>)?</p>
  
  <p><strong>Data sample</strong> (after the whole <code>sed</code> pipe):</p>
  
  <pre><code>500,2,13/09/2007,30000.00,12,B-1
  501,2,15/09/2007,14000.00,8,B-2
  </code></pre>
  
  <p><strong>Expected result</strong>:</p>
  
  <pre><code>500,2,2007-09-13,30000.00,12,B-1
  501,2,2007-09-15,14000.00,8,B-2
  </code></pre>
  
  <p>The reason I need to do this is because I need to import this data to MySQL. I could open the file in Excel and change the format by hand, but I would like to skip that.</p>