[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Re: Could ldap do max-like or count-like operation as SQL?



On Wed, Jun 21, 2000 at 10:17:29AM +0800, Yuqing Tang wrote:
> >On Tue, Jun 20, 2000 at 07:31:24PM +0800, Yuqing Tang wrote:
> >> As our project go on, we store lots of data into ldap, now we should
> >> do some statistics on these data, such as who is the oldest or even 
> >> who is the oldest 1000 or how many people live in CA. Could ldap do
> >> that? 
> >
> >LDAP search ...
> How to search? Should I search all the entries that satisfied some filter,
> and iterator through them to find the max or to count them?
> 
> I am new to this maillist, actually I am writing a client program to do that,
> should I fwd my questiong to another maillist?

RTFM.

ldapsearch '(age=*)' age | perl -e '$/ = "\n\n"; while( <> ) {/^uid=(\w+).*$/m; $u = $1; /^age=(.*)$/m; $p = $1; print "$p $u\n";}' | sort -n | head -1000 > top-1000-ages.txt

-d

-- 
come.to/dannyman