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

Re: Script for mass updates



Am Mittwoch, 01. Februar 2017 16:52 CET, Jephte Clain <jephte.clain@univ-reunion.fr> schrieb:

> using michaël's filter, you could try this:
>
> ldapsearch [options] '(&(ou:dn:=people)(!(ou=system))(!(displayName=*)))'
> cn | awk '
> /^dn:/ {
>   print
>   print "changetype: modify"
>   print "replace: displayName"
>   next
> }
> /^cn:/ {
>   sub(/^cn/, "displayName")
> }
> { print }
> ' | ldapmodify [options]
>
> we aren't doing your homework, are we? :-)

Danger, Will Robinson!
This will only work for dn values that aren't encoded.
That's a trivial job for perl or python (or whatever). AWK operates
on character streams and that's a bad fit for LDIF.

 Cheers, Ralf Mattes

> regards,
> Jephté
>