Is there some better solution for printing unique lines other than a combination of sort and uniq?
|
|
|||||
|
|
To print each identical line only one, in any order:
To print only the unique lines, in any order:
To print each identical line only once, in the order of their first occurrence: (for each line, print the line if it hasn't been seen yet, then in any case increment the seen counter)
To print only the unique lines, in the order of their first occurrence: (record each line in
|
|||||
|
|
Some (most?) versions of |
|||||||||||
|
|
Does Perl work for you? It can keep the lines in the original order, even if the duplicates are not adjacent. You could also code it in Python, or
Given input file:
It yields the output:
|
||||
|
|
