I am new to Linux and while I was trying to understand uinq command I encountered this problem I created a file hello2 using cat command and entered these text in it
hello
hello
google
hello
then I ran this command
sort hello2 | uniq
the output
google
hello
hello
so far what I understood about uniq command on that basis the output should be different
google
hello
can someone please understand why this happened?
There might be a space in one of the repeated words so the other hello is still outputted.
You can check on this article for a more detailed information regarding uniq.