The password for the next level is stored in the file data.txt and is the only line of text that occurs only once.
$ ssh [email protected] -p 2220
We need to find a unique line, something uniq was unsurprisingly built for. The command removes lines that are repeated. This means if you have two of the same line, but they are separated another line, they are not filtered out.
How do we get around this? Sort the file with sort. We’ll use a pipe to send the sorted file to uniq.
[email protected]:~$ sort data.txt | uniq
Oof. uniq without any options just removes the extra lines. What we want is a truly unique line. This is found by adding the -u option.
[email protected]:~$ sort data.txt | uniq -u