title: How to run the ‘:sort u’ command in Vim on a CSV table, but only use the values in a particular column as sorting keys?
body: <p>I am looking for a more specific version of the <code>:sort u</code> command that would allow removing all duplicate lines from a file. I am working with a CSV file, and would like to remove all the lines that have duplicates in their second-column entry. In other words, two lines are declared to be duplicates if they have the same value in the second column.</p>
  
  <p>For example, for the following file:</p>
  
  <pre><code>a,1,b
  g,1,f
  c,1,x
  i,2,l
  m,1,k
  o,2,p
  u,1,z
  </code></pre>
  
  <p>the command in question should yield:</p>
  
  <pre><code>a,1,b
  i,2,l
  </code></pre>
  
  <p>The choice of the specific rows to be kept are not important, as long as the second column entries are all unique.</p>
  
  <p>What Vim command will produce the output above?</p>
  
  <p>Thanks!</p>