You're viewing a comment by Catia Lavalle and its responses.
You're viewing a comment by Catia Lavalle and its responses.
I am being sponsored by Syntress! They bought me an amazing dedicated server to run catonmat on. If you're looking web services, I highly recommend the Syntress guys!
I love to read science books. They make my day and I get ideas for awesome blog posts, such as Busy Beaver, On Functors, Recursive Regular Expressions and many others.
Take a look at my
Amazon wish list, if you're curious about what I have planned reading next, and want to surprise me. :)
If you are interested in advertising on catonmat.net, contact me.
Free tools for coding on Vietstarsoft.com.
Programming homework help.


You did really a great job! But I still have 2 open questions. I explain with a practical example although there are many other situations where the same questions arise.
Say you have an LDAP directory and you want to add an attribute to all the entry of the directory which do not jet have it set.
First you do an LDIF export of your directory ending up with blocks of the kind:
then your problem is split in 3
1) Find which entry (1 dn: line = 1 entry identifier) already have the attribute already set
2) extract a list of all entries in the LDIF export except the ones in step (1) (which already have the attribute set)
3) write a script which use this entry list to add the missing attribute.
I know how to do the part (3). The problems are part (1) and (2) i.e. how to generate the list of entries to be modified. I have a solution but is not really elegant:
grep -n dn "export-secure.ldif" > ./tmp0.dat grep -n vkek "export-secure.ldif" >> ./tmp0.dat sort -n ./tmp0.dat | cut -d":" -f 2- | grep -B1 vkek | grep dn > ./list-vkek.dat grep dn "export-secure.ldif" > ./tmp.dat cp tmp.dat save.dat for NAME in $(awk '{print $2}' ./tmp1.dat mv ./tmp1.dat ./tmp.dat doneI am sure there are better ways.
Reply To This Comment