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

Re: Deleting certain attribute in all entries



At 09:06 AM 5/15/00 +0200, Jan-Piet Mens wrote:
>Something like this works for me:
>
>	ldapsearch attribute=* dn |

Technically, dn is not an attribute (though our server treats
it as such).  I recommend this instead requesting attribute
type 1.1.
	ldapsearch "(attribute=*)" 1.1

As no attribute type has the OID 1.1, the following will
only return the entry without any attributes.

>	grep -v '^$' |
>	while read dn
>	do
>		echo "dn: $dn"
		echo "changetype: delete"
>		echo "delete: attribute"
>		echo ""

You can also use replace:

		echo "dn: $dn"
		echo "changetype: modify"
		echo "replace: attribute"
		echo "-"
		echo ""

Replacing the attribute with no values also deletes the
attribute and should be successful even where the attribute
does not exist.

For details see slapd.replog(5) and ldapmodify(1).

>	done | ldapmodify -D "cn=manager,o=xx" -w secret
>
>Regards,
>	-JP
>
>On Sun, 14 May 2000, Marian Steinbach wrote:
>
>> I would like to know the easiest way to erase one atribute,
>> disregarding it´s value, from all directory entries that have
>> this attribute.
>
>