title: How to remove duplicates by column (inverse ordering)
body: <p>I've looking for this in here, but did not found the exact case. Sorry if it is duplicated, but I couldn't find it.</p>
  
  <p>I have a huge file in Debian that contains 4 columns separated by "#", with the following format:</p>
  
  <pre><code>username#source#date#time
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>A222222#Windows#2014-08-18#10:47:16
  A222222#Juniper#2014-08-07#14:31:40
  A222222#Juniper#2014-08-08#09:15:34
  A111111#Juniper#2014-08-10#14:32:55
  A111111#Windows#2014-08-08#10:27:30
  </code></pre>
  
  <p>I want to print unique rows based on the first two columns, and if duplicates found, it has to print the last event based on date/time. With the list above, the result should be:</p>
  
  <pre><code>A222222#Windows#2014-08-18#10:47:16
  A222222#Juniper#2014-08-08#09:15:34
  A111111#Juniper#2014-08-10#14:32:55
  A111111#Windows#2014-08-08#10:27:30
  </code></pre>
  
  <p>I have tested it using two commands:</p>
  
  <pre><code>cat file | sort -u -t# -k1,2
  cat file | sort -r -u -t# -k1,2
  </code></pre>
  
  <p>But both of them print the following:</p>
  
  <pre><code>A222222#Windows#2014-08-18#10:47:16
  A222222#Juniper#2014-08-07#14:31:40 --&gt; Wrong line, it is older than the duplicate one
  A111111#Juniper#2014-08-10#14:32:55
  A111111#Windows#2014-08-08#10:27:30
  </code></pre>
  
  <p>Is there any way to do it?</p>
  
  <p>Thanks!</p>