title: sorting a "key/value pair" array in bash
body: <p>How do I sort a "python dictionary-style" array <code>e.g. ( "A: 2" "B: 3" "C: 1" )</code> in bash by the value? I think, this code snippet will make it bit more clear about my question.</p>
  
  <pre><code>State="Total 4 0 1 1 2 0 0"
  W=$(echo $State | awk '{print $3}')
  C=$(echo $State | awk '{print $4}')
  U=$(echo $State | awk '{print $5}')
  M=$(echo $State | awk '{print $6}')
  WCUM=( "Owner: $W;" "Claimed: $C;" "Unclaimed: $U;" "Matched: $M" )
  echo ${WCUM[@]}
  </code></pre>
  
  <p>This will simply print the array: <code>Owner: 0; Claimed: 1; Unclaimed: 1; Matched: 2</code></p>
  
  <p>How do I sort the array (or the output), eliminating any pair with "0" value, so that the result like this:</p>
  
  <pre><code>Matched: 2; Claimed: 1; Unclaimed: 1
  </code></pre>
  
  <p>Thanks in advance for any help or suggestions. Cheers!!</p>