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

Re: deleting attribute from commandline



Hi,

On Thursday 08 May 2003 18:01, Jeroen Vriesman wrote:
> In my ldap database I have dn's with all kinds of attributes, some of these
> attributes are appear there multiple times per account.
>
> Like
>
> dn: cn=User,ou=Unit,o=Company
> 	seeAlso: someoneelse,ou=Unit,o=Company
> 	seeAlso: anotherone,ou=Unit,o=Company
> 	seeAlso: yetanotherone,ou=Unit,o=Company
>
>
> Now, I want to delete one of these 'seeAlso' from the commmandline, eg the
> second one, I cannot see how to do that with ldapdelete. If it's impossible
> from a shell script with ldapdelete, how to do that in Perl?

The ldap* tools are named by their actions on entries.
You do not want to to delete an entry but modify one 
by deleting some values of an attribute.
To achieve this you need ldapmodify.

To delete one value of a multi valued attribute of an entry you need 
to call ldapmodify with an LDIF file that contains something like this:

	dn: cn=User,ou=Unit,o=Company
	changetype: modify
	replace: seeAlso
	seeAlso: anotherone,ou=Unit,o=Company
	seeAlso: yetanotherone,ou=Unit,o=Company
	-

This replaces the current values of seeAlso with the ones given.

IIRC the following LDIF should be a functionally equivalent alternative

	dn: cn=User,ou=Unit,o=Company
	changetype: modify
	delete: seeAlso
	seeAlso: someoneelse,ou=Unit,o=Company
	-

It deletes the one value you do not want any more.

Peter

-- 
Peter Marschall
eMail: peter@adpm.de