Uniq Not Working Correctly? You Need to Use Sort First

Uniq Not Working Correctly? You Need to Use Sort First

cat file.txt | uniq is incorrect
cat file | sort | uniq is correct

Why? From the manual:

Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output).

Leave a Reply

Your email address will not be published. Required fields are marked *