compare-sorted-windows

Find lines missing from the current or next windows.

This command copies all lines that appear in both the current window's
buffer, and the next window's buffer, into a buffer named "inboth".
It copies other lines to buffers named "only1" and "only2". It
assumes that you already sorted the original buffers.