title: Add a double quote to a string if it doesn't start with a double quote
body: <p>I have a text file like this:</p>
  
  <pre><code>1,a,"some strings in a pair of double quotes"
  2,b,"more strings in a pair of double quotes"
  3,c,some messy strings with only right half double quotes"
  4.d,"more strings in a pair of double quotes"
  </code></pre>
  
  <p>I tried to use awk with sed to add the missing left double quote to the 3rd line:</p>
  
  <pre><code>function addQuote(input) {
   return '"' + input
  }    
  BEGIN{
     FS=","
  }
  
  {
    if ($3~/^"/) s = $3
    else s = addQuote($3)
  
    print $1,$2,s
  }
  </code></pre>
  
  <p>It seems that the <code>addQuote</code> function is not working but I don't know how to fix it. </p>
  
  <p>I know in <code>sed</code> I can easily add a double quote to begining of a line by doing <code>sed 's/^/"/' line</code>, but I don't know how to make it work together with <code>awk</code>.
  Please kindly help. Thanks!</p>