title: Remove duplicated rows based on two columns (in both directions) and sorted by a third column
body: <p>I'd like to remove duplicated rows from a file that look like this:</p>
  
  <pre><code>A   B   1e-149
  A   B   7e-136
  A   C   6e-147
  A   C   3e-131
  B   C   0.0
  B   A   4e-150
  B   A   1e-136
  C   B   0.0
  C   A   5e-148
  C   A   7e-135
  </code></pre>
  
  <p>based on columns 1 and 2. </p>
  
  <p>So far, I'm trying:</p>
  
  <pre><code>awk '!a[$1$2]++' file
  </code></pre>
  
  <p>which results in</p>
  
  <pre><code>A   B   1e-149
  A   C   6e-147
  B   C   0.0
  B   A   4e-150
  C   B   0.0
  C   A   5e-148
  </code></pre>
  
  <p>However, I'd like to remove also those rows whose fields in columns 2 and 1 were also found. Ideally, I'd like to keep the ones with the lowest value in column three, thus resulting in:</p>
  
  <pre><code>B   A   4.00E-150
  B   C   0
  C   A   5e-148
  </code></pre>
  
  <p>Is there any way of doing this using awk and/or sort?</p>