[prev in list] [next in list] [prev in thread] [next in thread] 

List:       suse-slox-e
Subject:    Re: [suse-slox-e] LDAP question
From:       Peter Schober <sp+lists.slox () univie ! ac ! at>
Date:       2005-04-20 10:24:53
Message-ID: 20050420102453.GM32246 () pcsp ! cc ! univie ! ac ! at
[Download RAW message or body]

peer,

* Dr.Peer-Joachim Koch <pkoch@bgc-jena.mpg.de> [2005-04-20 11:43]:
> I would like to know, if it's possible to get the ldapsearch result
> sorted ?

no, results are returened in database-order.

> Something like ldapsearch -x -LLL uid=* uid gid cn
> shows sometime cn first, sometimes gid first ...
> 
> Is there a switch - or is awk the (only) answer ?

well, there is 'man ldapsearch' ;) (ldapsearch -S attribute), but this
sorts the entries returned by that attribute, not the attributes
themselfs.

rather than messing with the shell (remember e.g. that all attributes
containing umlauts etc. are returned base64-encoded, which you'd first
have to decode before sorting; also longer lines will break and
continue with leading whitespace, which doesn not work well from the
shell either) and doing your own sorting you might want to use Perl's
Net::LDAP. http://search.cpan.org/~gbarr/perl-ldap/lib/Net/LDAP.pod

cheers,
-p,schober

-- 
peter.schober@univie.ac.at - vienna university computer center
Universitaetsstrasse 7, A-1010 Wien, Austria/Europe
Tel. +43-1-4277-14155, Fax. +43-1-4277-9140

-- 
See the List-Unsubscribe header to unsubscribe
For additional commands, email: suse-slox-e-help@suse.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic