fork download
  1. BEGIN { RS = "gidNumber: [0-9]+" ; FS = "\n" ; OFS=","}
  2. { for (i=1;i<=NF;i++) {
  3. if ($i ~ "^cn: ") { cn=gensub("^cn: ","","g",$i) }
  4. if ($i ~ "^uidNumber: ") { uidNum=gensub("^uidNumber: ","","g",$i) }
  5. if ($i ~ "^uid: ") { uid=gensub("^uid: ","","g",$i) }
  6. }
  7. if ( cn > "" && uid > "" && uidNum > "" ) {
  8. print cn, uid, uidNum
  9. }
  10. cn="" ; uid="" ; uidNum=""
  11. }
Success #stdin #stdout 0.01s 4232KB
stdin
# extended LDIF
#
# LDAPv3
# base <ou=People,dc=example,dc=com> with scope subtree
# filter: uid=jdoe
# requesting: ALL
#

# jdoe, people, example.com
dn: uid=jdoe,ou=people,dc=example,dc=com
cn: John Doe
homeDirectory: /afs/rats.example.com/users/t/jdoe
loginShell: /bin/bash
objectClass: posixAccount
uid: jdoe
uidNumber: 9239
gidNumber: 100002
# jdoe, people, example.com
dn: uid=jDOE,ou=people,dc=example,dc=com
cn: JANE DEO
homeDirectory: /afs/rats.example.com/users/t/jdoe
loginShell: /bin/bash
objectClass: posixAccount
uid: jdoe
uidNumber: 6969
gidNumber: 100002



# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1
stdout
John Doe,jdoe,9239
JANE DEO,jdoe,6969