Reputation: 3
this is what i have:
ldapsearch -x -LLL "(uid=z*)" cn | grep "^cn:" | sort -r --ignore-case | cut -c5-999
How do i get this result in Alphabetical order?
Upvotes: 0
Views: 1271
Reputation: 1318
Depending on the LDAP server and its configuration you can try to use the so-called server-side sorting control as defined in RFC 2891.
Note that not all LDAP servers support this or have activated it. E.g. OpenLDAP server has to be configured with overlay slapo-sssvlv.
Furthermore an ORDERING
matching rule has to be specified suitable for attribute type used for sorting. Either it's specified by default in the subschema or has to be specified in the search request.
This example without ordering matching rule results in error:
$ ldapsearch -LLL -E sss=-uid
Inappropriate matching (18)
Additional information: serverSort control: No ordering rule
This works:
$ ldapsearch -LLL -E sss=-uid:caseIgnoreOrderingMatch
Upvotes: 3