Guest User

Untitled

a guest
Nov 16th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. dn: cn=testuser2@abc.com, ou=persons,ou=pp,dc=abc,dc=com
  2. dn: cn=testuser3@nabc.com, ou=persons,ou=pp,dc=abc,dc=com
  3. dn: cn=testuser4@abc.com, ou=persons,ou=pp,dc=abc,dc=com
  4. dn: cn=testuser5@abc.com, ou=persons,ou=pp,dc=abc,dc=com
  5.  
  6. dn: cn=testuser2@abc.com, ou=persons,ou=pp,dc=abc,dc=com
  7. changetype: modify
  8. add: mail
  9. mail: testuser2@abc.com
  10.  
  11. dn: cn=testuser3@nabc.com, ou=persons,ou=pp,dc=abc,dc=com
  12. changetype: modify
  13. add: mail
  14. mail: testuser3@nabc.com
  15.  
  16. dn: cn=testuser4@abc.com, ou=persons,ou=pp,dc=abc,dc=com
  17. changetype: modify
  18. add: mail
  19. mail: testuser4@abc.com
  20.  
  21. dn: cn=testuser5@abc.com, ou=persons,ou=pp,dc=abc,dc=com
  22. changetype: modify
  23. add: mail
  24. mail: testuser5@abc.com
  25.  
  26. changetype: modify
  27. add: mail
  28. mail:
  29.  
  30. sed -e 's/$/n changetype: modify n add: mail n mail:/' -i alluserdns.ldif
  31.  
  32. dn: cn=testuser2@abc.com, ou=persons,ou=pp,dc=abc,dc=com
  33. changetype: modify
  34. add: mail
  35. mail:
  36.  
  37. sed -e 's/.*cn=([^,]*).*/&nchangetype: modify nadd: mail nmail: 1/'
  38.  
  39. awk '{print $0;match($2, /=(.*),/, arr); if(arr[1]!="") {print "changetype: modifynadd:mailnmail: " arr[1] }}' <input file>
Add Comment
Please, Sign In to add comment