Shell Magic: Set Operations with uniq
This is a neat hack! For two input files, the intersection and relative complement can be done more straightforwardly with comm.<p><a href="https://en.wikipedia.org/wiki/Comm" rel="nofollow">https://en.wikipedia.org/wiki/Comm</a><p><pre><code>  # show only items in both a and b
  comm -1 -2 a_list b_list

  # show only items unique to a
  comm -2 -3 a_list b_list

  # show only items unique to b
  comm -1 -3 a_list b_list</code></pre>