Skip to content

Instantly share code, notes, and snippets.

@benbek
Created May 15, 2016 19:34
Show Gist options
  • Save benbek/e8f29d3eb355a60c8e09becd596e9f0d to your computer and use it in GitHub Desktop.
Save benbek/e8f29d3eb355a60c8e09becd596e9f0d to your computer and use it in GitHub Desktop.
Get a formatted list of all employees from LDAP
#!/bin/bash
# sort people by username (column 2) alphabetically
ldapsearch -H ldap://ldap.SERVER.com -x -b dc=__DOMAIN__,dc=com | grep ^# | sed -e 's/#//' -e 's/,//g' -e 's/ __DOMAIN__.com//' -e 's/ People//' | sort -k 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment