Domenico Maimone wrote:
1)ldapsearch ----> file.ldif
2) file.ldif---> add_objectclass_for_any_entry.sh ----> file2-ldif
3) ldapmodify file2.ldif
You may have problems with ordering of attributes etc.
I recommend using perl LDAP module for this: <http://search.cpan.org/~gbarr/perl-ldap-0.31/lib/Net/LDAP.pod>
Or if you're brave, you can try doing this online with Net::LDAP object.