Great!  I'll try that out.<br><br>Thanks,<br><br>David<br><br><div class="gmail_quote">On Mon, Apr 21, 2008 at 10:04 AM, J. Hartman <<a href="mailto:joona.hartman@gmail.com">joona.hartman@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I can't remember how exactly I did it, but I recall I used awk and sort in between to count the line length (awk) and do numeric sort on the resulting line.<br>
<br>Something like this:<br><br>$ ldapsearch -b BASEDN "objectclass=*" | awk '/dn:/ {l=length($0); sub(/dn:/,""); print l $0}' | sort -n | cut ... | ldapdelete ...<br>
<br>Gets a bit nasty but something like that should work.<br><br>Hope that helps!<div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Fri, Apr 18, 2008 at 5:26 PM, Chun Tat David Chu <<a href="mailto:beyonddc.storage@gmail.com" target="_blank">beyonddc.storage@gmail.com</a>> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Joona,<br><br>Do you mind to show me how to sort by DN length? and execute the ldapdelete?<br>

I looked at it a bit but I couldn't figure out.<br><br>Thanks!<br><font color="#888888"><br>David</font><div><div></div><div><br><br><div class="gmail_quote">On Fri, Apr 18, 2008 at 6:41 AM, J. Hartman <<a href="mailto:joona.hartman@gmail.com" target="_blank">joona.hartman@gmail.com</a>> wrote:<br>


<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br><br>I've done subtree deletion sometimes by sorting based on DN length. Delete longest DNs first and it's certain that they are the leafs. The whole thing can be done in a one-liner. <br>


<br>-Joona<br><br><div class="gmail_quote"><div>
On Thu, Apr 17, 2008 at 9:32 PM, Chun Tat David Chu <<a href="mailto:beyonddc.storage@gmail.com" target="_blank">beyonddc.storage@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<div>
Hi group,<br><br>I figured out how to sort in descending order using ldapsearch.<br><br>By default, it will always sort in ascending order.  If I need to sort in descending then I need to add a "-" prefix before my attribute name.  (e.g. -S -createtimestamp).<br>




<br>In addition, I can only get the descending search work only if I specify the sorting to be done by the server by passing the "-x" flag.<br><br>I still have the question about what is the best way to delete a hierarchy tree using command line utility provided by Fedora-DS package.<br>




<br>My current plan is to do a ldapsearch with subtree scope and sort the createtimestamp attribute in descending order.  Then take the output and run it with ldapdelete.<br><br>Thanks!<br><font color="#888888"><br>David</font><div>



<div></div><div><br><br><div class="gmail_quote">
On Thu, Apr 17, 2008 at 2:01 PM, Chun Tat David Chu <<a href="mailto:beyonddc.storage@gmail.com" target="_blank">beyonddc.storage@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




Hi group,<br><br>I've a question about deleting the hierarchy tree using the Fedora DS provided command line utilities (e.g. ldapdelete, ldapsearch, ldapmodify and etc).<br><br>Originally, I'm using the "ldapdelete" command from the openldapclient package with the "-r" flag to do recursive delete on the hierarchy tree, but I want to know if there's anyway I can achieve the same effect by using command line utilities from the Fedora DS package.<br>





<br>My original thought is to use ldapsearch, set it to return only the "dn" attribute and sorted by "createtimestamp" attribute.  Then use the returned result and run the ldapdelete command.  Assuming a child entry must have a later "createtimestamp" then parent entry.  However, the result returned back from ldapsearch is in ascending order of the "createtimestamp" attribute.<br>





<br>Is there a way to tell the ldapsearch command to sort returned result in descending order?  or<br>Is there a more efficient way to delete a hierarchy tree through command line?<br><br>Thanks!<br><font color="#888888"><br>




David<br>
</font></blockquote></div><br>
</div></div><br></div>--<br>
Fedora-directory-users mailing list<br>
<a href="mailto:Fedora-directory-users@redhat.com" target="_blank">Fedora-directory-users@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/fedora-directory-users" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-directory-users</a><br>
<br></blockquote></div><br>
<br>--<br>
Fedora-directory-users mailing list<br>
<a href="mailto:Fedora-directory-users@redhat.com" target="_blank">Fedora-directory-users@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/fedora-directory-users" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-directory-users</a><br>
<br></blockquote></div><br>
</div></div><br>--<br>
Fedora-directory-users mailing list<br>
<a href="mailto:Fedora-directory-users@redhat.com" target="_blank">Fedora-directory-users@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/fedora-directory-users" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-directory-users</a><br>
<br></blockquote></div><br>
</div></div><br>--<br>
Fedora-directory-users mailing list<br>
<a href="mailto:Fedora-directory-users@redhat.com">Fedora-directory-users@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/fedora-directory-users" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-directory-users</a><br>
<br></blockquote></div><br>