title: How to increment a counter when a value is found in awk
body: <p>I am trying to write an awk script. part of the code needs to count the number of times $10 (in the code below its 256) is a certain value. 
  The possibilities are 4, 8, 16, 32, 64, 128, 256
  Each time one of these values appears I want a corresponding variable to be incremented by one.</p>
  
  <p>My block of code is </p>
  
  <pre><code>{
  if ($10 == "4") {bs_4k++} 
  else if ($10 == "8") {bs_8k++}
  if ($10 == "16") {bs_16k++}
  if ($10 == "32") {bs_32k++}
  if ($10 == "64") {bs_64k++}
  if ($10 == "128") {bs_128k++}
  if ($10 == "256") {bs_256k++}
  };
  </code></pre>
  
  <p>This is the format of the data:</p>
  
  <pre><code>259,0   23        1     0.000000000     0  C  WS 167588096 + 256 [0]
  259,0   23        2     0.000002073     0  C  WS 167588352 + 256 [0]
  259,0   23        3     0.000004040     0  C  WS 167587840 + 256 [0]
  </code></pre>
  
  <p>And my code to print results:</p>
  
  <pre><code>END {
       print "Number of 256k blocks: " 256k_bs;
       print "Number of 128k blocks: "128k_bs;
       print "Number of 64k blocks: " 64k_bs;
       print "Number of 32k blocks: " 32k_bs;
       print "Number of 16k blocks: " 16k_bs;
       print "Number of 8k blocks: " 8k_bs;
       print "Number of 4k blocks: " 4k_bs;
  };
  </code></pre>
  
  <p>When I try to print the variable I get:</p>
  
  <pre><code>Number of 256k blocks: 256
  Number of 128k blocks: 128
  Number of 64k blocks: 64
  Number of 32k blocks: 32
  Number of 16k blocks: 16
  Number of 8k blocks: 8
  Number of 4k blocks: 4
  </code></pre>
  
  <p>Any help is appreciated.</p>