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).