Quote:
Originally Posted by Nevahre
why use 2 progrs: sort -u local.cf
sort has a unique (-u/--unique) option.....
|
What command to use depends on what result you expect.
Look at that file:
$ cat file
Code:
one
two
three
two
three
three
four
four
four
four
That command removes consecutive duplicated lines:
$ uniq -u file
That command counts consecutive duplicated lines:
$ uniq -dc file
That commands counts occurrences of all lines:
$ sort file | uniq -c
Code:
4 four
1 one
3 three
2 two
That command does the same but sorts result taking into considerance the numbers of occurrences:
$ sort file | uniq -c | sort -nr
Code:
4 four
3 three
2 two
1 one
That command displays each unique line only once:
$ sort -u file