Sample Header Ad - 728x90

What is the difference between "sort -u" and "sort | uniq"?

179 votes
5 answers
293297 views
Everywhere I see someone needing to get a sorted, unique list, they always pipe to sort | uniq. I've never seen any examples where someone uses sort -u instead. Why not? What's the difference, and why is it better to use uniq than the unique flag to sort?
Asked by Benubird (6082 rep)
May 16, 2013, 11:22 AM
Last activity: May 31, 2022, 04:15 AM