Using search filters with ldapsearch
You must use a search filter to specify the attributes for which to search.
About this task
The syntax for a search filter is:
"attribute operator value"
For example, this search filter finds all entries containing Smith as the value for the sn (surname) attribute:
"sn=Smith"
You can specify any attribute stored in a directory in a search filter. The following are common attributes used to search for entries about people:
- cn -- a person's common name
- sn -- a person's last name
- telephonenumber -- a person's telephone number
- l -- a person's geographic location
You can specify search filters on the ldapsearch command line, or you can specify them in a file and use the ldapsearch parameter -f to refer to the file. If you use a file, specify each search filter on a separate line.
Note you can include language tags in a search filter if the LDAP directory, such as the Domino® Directory, supports them. For example:
"givenName;lang-fr=Etienne"
Multiple search filters with Boolean operators
About this task
You can use multiple search filters and Boolean operators. Use this syntax:
"(operator(filter)(filter))"
For example, use this search filter to find entries with the surname Browning and the location Dallas.
"(&(sn=Browning)(l=Dallas))"
You can nest Boolean operators. For example, use this search filter to find entries with the surname Caneel or givenname Alfred in the mail domain MDN:
"(&(maildomain=MDN)(|(sn=caneel)(givenname=alfred)))"