Is there a unix command that can check if any two lines in a file are the same?
For e.g. Consider a file sentences.txt
This is sentence X
This is sentence Y
This is sentence Z
This is sentence X
This is sentence A
This is sentence B
We see that the sentence
This is sentence X
is repeated.
Is there any command that can quickly detect this, so that I can perhaps execute it like this -
$ cat sentences.txt | thecommand
Line 1:This is sentence X
Line 4:This is sentence X