title: sed or awk : group by 2 columns and get the last value of another column
body: <p>I need to quickly process a text file which has lots of redundancy.
  I can use python, but I think the easiest and fastest will be using awk, sed or perl in the unix shell.</p>
  
  <p>The data has 3 columns, I need to group by (unique) column 1 and 3, then get the last value of the 2nd column</p>
  
  <pre><code>1,2,3
  a 1 A
  a 2 A
  a 3 A
  b 2 C
  b 3 C
  b 3 D
  c 1 C
  c 1 D
  c 2 D
  </code></pre>
  
  <p>The results should be like:</p>
  
  <pre><code>1,2,3
  a A 3
  b C 3
  b D 3
  c C 1
  c D 2
  </code></pre>