Judy
Judy

Reputation: 31

I want a shell script that reads a specific attribute value from an ldapsearch result

I am trying to write a script that finds the checks homefolder quotas, and sends emails to users who are exceeding a certain percentage of their quota, we have 389 ldap server, I can search the ldap for a uid, and the result is in ldif format. I can not figure out how to read the value of the attribute corresponding to email, lets say personalEmail: hisEmail I want to read the value of the personalEmail attribute, i.e. hisEmail

thanks

Upvotes: 2

Views: 5139

Answers (1)

glenn jackman
glenn jackman

Reputation: 247012

ldapsearch ... | awk -F ": " '$1 == "desiredAttribute" {print $2}'

Upvotes: 5

Related Questions