Re: uniq without sort <-------------- GURU NEEDED
am 25.01.2008 13:22:47 von William James
On Jan 25, 4:50 am, Stephane Chazelas
wrote:
> On Fri, 25 Jan 2008 02:39:23 -0800 (PST), William James wrote:
>
> [...]> ruby -e 'puts ARGF.to_a.uniq' the_file
>
> [...]
>
> zsh:
>
> print -rl -- ${(uf)"$(
>
> (will remove empty lines, and will output an empty line if the
> file is empty).
The Ruby program is devoid of those defects.
In addition, it is more pleasing to the eye and
to the mind.
Re: uniq without sort <-------------- GURU NEEDED
am 25.01.2008 13:52:00 von Stephane CHAZELAS
On Fri, 25 Jan 2008 04:22:47 -0800 (PST), William James wrote:
[...]
>> [...]> ruby -e 'puts ARGF.to_a.uniq' the_file
[...]
>> zsh:
>>
>> print -rl -- ${(uf)"$(
>>
>> (will remove empty lines, and will output an empty line if the
>> file is empty).
>
> The Ruby program is devoid of those defects.
> In addition, it is more pleasing to the eye and
> to the mind.
[...]
Indeed and probably faster as well for big files. Note that the
above ruby and zsh versions share the same drawback when
compared to the awk version in that they store the whole
original file in memory instead of just the uniq values.
--
Stephane