Use sort -Vu instead of uniq.