Reputation: 1
Trying to sort a file with multiples occurring lines and return a text that only occurs once.
I am trying the over the wire game to increase my Linux proficient, but I run into a question...
In level 8 -> 9 the password for the next level is stored in the file data.txt
and is the only line of text that occurs only once. I researched and came to the following answer:
$ sort -cu data.txt
It printed a single output:
sort: data.txt:2: disorder: desthMrvBwFuSWkom7FP8ASJayNlfoRd
I expected sorting the file and returning a unique line, but I was not sure if it was the right one. So I did some more research, now using stackoverflow and others communities and find another solution:
$ sort data.txt| uniq -u
It printed a different output:
1 EN632PlfYiZbn3PhVK3XOGSlNInNE00t
I don't understand why the first command is not returning the right password, and returning a line that is repeated.
Upvotes: 0
Views: 126
Reputation: 3583
The -c
option doesn't sort, it checks if the file is already sorted
Upvotes: 1