Re: uniq without sort <-------------- GURU NEEDED
am 25.01.2008 17:47:03 von Glenn HutchingsOn Jan 25, 2:45 am, gnuist...@gmail.com wrote:
> The algorithm is this. For every line, look above if there is another
> line like it. If so, then ignore it. If not, then output it. I am
> sure, I can spend some time to write this in C. But what is the
> solution using shell ? This way I can get an output that preserves the
> order of first occurrence. It is needed in many problems.
perl -ne 'print unless $seen{$_}++' [files]