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

Re: Script for mass updates



hello,

he asked for a quick and dirty way with bash, so that's what I gave him.
however, I'm curious: can you give me an example of input my script can't handle?

regards,
Jephté

2017-02-01 20:23 GMT+04:00 Ralf Mattes <rm@mh-freiburg.de>:

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é
>










--
Jephté CLAIN | Développeur, Intégrateur d'applications
Service Système d'Information
Direction des Systèmes d'Information
Tél: +262 262 93 86 31 || Gsm: +262 692 29 58 24