in reply to Re: Possible faster way to do this?
in thread Possible faster way to do this?

Which, btw, can be achieved by GNU's uniq which - my guess - is the most efficient way to do that.

That isn't what uniq does. It removes adjacent duplicate lines only. This is why everyone sorts before running uniq.

$ echo -e "foo\nbar\nfoo" | uniq foo bar foo $ echo -e "foo\nbar\nfoo" | sort | uniq bar foo $

Replies are listed 'Best First'.
Re^3: Possible faster way to do this?
by bliako (Abbot) on Jun 25, 2019 at 10:46 UTC

    yep, sorry for me spreading the wrong information, i have edited my answer. (and added one Perl and one C++ proper-uniqs)