Skip to content

Instantly share code, notes, and snippets.

@boina-n
Created December 17, 2018 10:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save boina-n/807da08b23e749de34892af23685d8c2 to your computer and use it in GitHub Desktop.
Save boina-n/807da08b23e749de34892af23685d8c2 to your computer and use it in GitHub Desktop.
ldap search for CN
cat /tmp/list.cuid.txt | while read line ; do echo $( echo "$line;"$(ldapsearch -H ldaps://$ldapserver -w $ldappassword -b "dc=domain,dc=exemple,dc=com" -D "CN="$cuid",OU=Utilisateurs,OU=France Telecom,DC=domain,DC=exemple,DC=com" -s sub "CN=$line" | grep "displayName:\|department:\|telephoneNumber:\|mail:" | awk -F ":" '{ $1 ~ "telephone ; print $2 }' | tr '\n' ';' ) ); done | tee /tmp/list.cuid.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment