HI i have file call
groups.ldif and it has bellow lines

dn: cn=tps-uk,ou=groups,l=UK,dc=domain,dc=lan
uniqueMember: uid=salam,ou=users,l=UK,dc=domain,dc=lan
dn: cn=dev-admin,ou=groups,l=UK,dc=domain,dc=lan
memberUid: uid=salam,ou=users,l=UK,dc=domain,dc=lan

Basically i want to insert 2 lines in between dn and uniquemember or dn
and memberUID
which is :

changetype: modify
delete: uniqueMember

changetype: modify
delete: uniqueMember

Now the logic is :

if it see like this

dn: cn=tps-uk,ou=groups,l=UK,dc=domain,dc=lan
uniqueMember: uid=salam,ou=users,l=UK,dc=domain,dc=lan


then some how i need to insert those 2 lines so it will be :

dn: cn=tps-uk,ou=groups,l=UK,dc=domain,dc=lan
changetype: modify
delete: uniqueMember
uniqueMember: uid=salam,ou=users,l=UK,dc=domain,dc=lan

but if he see like this

dn: cn=dev-admin,ou=groups,l=UK,dc=domain,dc=lan
memberUid: uid=salam,ou=users,l=UK,dc=domain,dc=lan

it has to be like this
dn: cn=dev-admin,ou=groups,l=UK,dc=domain,dc=lan
changetype: modify
delete: uniqueMember
memberUid: uid=salam,ou=users,l=UK,dc=domain,dc=lan



so the end result will be

dn: cn=tps-uk,ou=groups,l=UK,dc=domain,dc=lan
changetype: modify
delete: uniqueMember
uniqueMember: uid=salam,ou=users,l=UK,dc=domain,dc=lan
dn: cn=dev-admin,ou=groups,l=UK,dc=domain,dc=lan
changetype: modify
delete: uniqueMember
memberUid: uid=salam,ou=users,l=UK,dc=domain,dc=lan



I would really appreciate any thoughts on this

-- 
Posted via http://www.ruby-forum.com/.