Python replacement for the uniq command.
#!/usr/bin/env python3
import sys
seen = set()
for line in sys.stdin:
if line not in seen:
seen.add(line)
sys.stdout.write(line)
This is not equivalent to sort -u because it preserves the original order, and it’s not equivalent to uniq because it removes duplicates even when they’re not adjacent.
