title: AWK: How to use OFS ignoring blank and commented out lines
body: <p>I'm trying to rewrite a file on the fly, like this:</p>
  
  <pre><code>10.213.20.173, mem_chld, p3b-aggr-103, c3.xlarge, db, mysql
  #10.213.20.191, mem_leaf, p3b-leaf-101, r3.xlarge, db, mysql
  10.213.20.192, mem_leaf, p3b-leaf-102, r3.xlarge, db, mysql
  
  10.213.20.190, mem_leaf, p3b-leaf-103, r3.xlarge, db, mysql
  .....
  </code></pre>
  
  <p>from the original <code>,</code> separated filed to a <code>:</code> separated ones. So, I used this:</p>
  
  <pre><code>awk -F', ' 'BEGIN{OFS=":";} { $1=$1; print }'
  </code></pre>
  
  <p>which is pretty much working but that file also has some blank and commented out lines, which I also want to exclude. My attempt with:</p>
  
  <pre><code>awk -F', ' '!/^(#|$)/ {OFS=":";} { $1=$1; print }'
  </code></pre>
  
  <p>did not work as I expected. How can I do that? Best!</p>