Set intersection and difference at the command line
A few years ago I wrote about comm, a utility that lets you do set theory at the command line. It’s a really useful little program, but it has two drawbacks: the syntax is hard to remember, and the input files must be sorted. If A and B are two sorted lists, comm A B prints A − B, B − A, and A ∩ B. You usually don’t want all three, and so comm lets you filter […]