What does this print?
printf 'a\nb\na\n' | uniq | wc -l
3210
uniq only collapses adjacent duplicates; the two a lines are not next to each other, so all 3 survive. Sort first to dedupe.printf 'a\nb\na\n' | uniq | wc -l
3210uniq only collapses adjacent duplicates; the two a lines are not next to each other, so all 3 survive. Sort first to dedupe.