If we do not care about the order, then the best solution is actually:
sort -u file
If we also want to ignore the case letter, we can use it (as a result all letters will be converted to uppercase):
sort -fu file
It would seem that even a better idea would be to use the command:
uniq file
and if we also want to ignore the case letter (as a result the first row of duplicates is returned, without any change in case):
uniq -i file
However, in this case, may be returned a completely different result, than in case when we use the sort
command, because uniq
command does not detect repeated lines unless they are adjacent.