Categories
Unix Notes

LDAP search from the command line

Get a name, dbkey, and email address from ldap

ldapsearch -hldap.arizona.edu -LLL -x
“(mail=*payne*@*arizona.edu)” dn mail
|
perl -p -i -e
‘ s/.*cn=(.*)+dbkey=([0-9]+),.*/1~2/; s/mail: (.*)/1/’

all of that on one line – or use the continuation characters