title: AWK: how to match a comma
body: <p>I want to return lines from awk with a pattern "C," or ".<em>,C" or ".</em>,C,.*".
  For example:</p>
  
  <h3>Valid</h3>
  
  <pre><code>C,G
  G,C
  G,C,A
  </code></pre>
  
  <h3>Invalid</h3>
  
  <pre><code>G,CC
  </code></pre>
  
  <p>My code is below:</p>
  
  <pre><code> echo G,CC | awk '$0 ~ /^C,+.*|.*,C,*.*/ {print $0}'
  </code></pre>
  
  <h2>output:</h2>
  
  <pre><code>G,CC
  </code></pre>
  
  <p>I hope it returns nothing to me. Unfortunately, it returns "G,CC" to me.</p>
  
  <p>How do I solve this problem?</p>
  
  <h3>Edit:</h3>
  
  <p>Based on the answers from @Emma and @perreal. I used a shorter command line to solve my question:</p>
  
  <pre><code>awk '$0 ~ /^C,.*|.*,C,.*|.*,C$/ {print $0}'
  </code></pre>
  
  <p>Until now, it works well. Thanks for your help!!</p>