Skip Navigation Links | |
Exit Print View | |
System Administration Guide: Naming and Directory Services (NIS+) |
Part I About Naming and Directory Services
Part II NIS+ Setup and Configuration
4. Configuring NIS+ With Scripts
5. Setting Up the NIS+ Root Domain
8. Configuring an NIS+ Non-Root Domain
10. NIS+ Tables and Information
12. Administering NIS+ Credentials
14. Administering Enhanced NIS+ Security Credentials
15. Administering NIS+ Access Rights
16. Administering NIS+ Passwords
18. Administering NIS+ Directories
Using the nistbladm Command With NIS+ Tables
nistbladm and NIS+ Column Values
nistbladm, Searchable NIS+ Columns, Keys, and Column Values
nistbladm and Indexed NIS+ Names
Creating Additional NIS+ Automount Tables
Adding Entries to an NIS+ Table
Adding an NIS+ Table Entry With the -a Option
Adding an NIS+ Table Entry With the -A Option
Editing an NIS+ Table Entry With the -e Option
Editing an NIS+ Table Entry With the -E Option
Removing NIS+ Single Table Entries
Removing Multiple Entries From an NIS+ Table
Displaying the Contents of an NIS+ Table
Displaying the Object Properties of an NIS+ Table or Entry
About Regular Expressions in NIS+
nismatch and nisgrep Command Syntax
Searching the First Column in NIS+
Expanding a Directory Into an NIS+ Domain
Expanding a Directory Into an NIS-Compatible Domain
Loading Information Into NIS+ From a File
Loading Data From an NIS Map Into NIS+
Dumping the Contents of an NIS+ Table to a File
20. NIS+ Server Use Customization
23. Information in NIS+ Tables
Common NIS+ Namespace Error Messages
The nismatch and nisgrep commands search through NIS+ tables for entries that match a particular string or regular expression, respectively. They display either the entries themselves or a count of how many entries matched. The differences between the nismatch and nisgrep commands are highlighted in Table 19-6 below.
Table 19-6 Characteristics of nismatch and nisgrep
|
The tasks and examples in this section describe the syntax for both commands.
To use either command, you must have read access to the table you are searching through.
The examples in this section are based on the values in the following table, named depts.doc.com. Only the first two columns are searchable.
|
Regular expressions are combinations of text and symbols that you can use to search for special configurations of column values. For example, the regular expression `Hello' searches for a value that begins with Hello. When using a regular expression in the command line, be sure to enclose it in quotes, since many of the regular expression symbols have special meaning to the Bourne and C shells. For example:
rootmaster% nisgrep -h greeting='Hello' phrases.doc.com.
The regular expression symbols are summarized in Table 19-7, below.
Table 19-7 Regular Expression Symbols in NIS+
|
To search through the first column, use:
nismatch string tablename nisgrep reg-exp tablename
To search through a particular column, use:
nismatch column=string tablename nisgrep column=reg-exp tablename
To search through multiple columns, use:
nismatch column=string tablename ...\ nismatch [column=string,...],tablename nisgrep column=reg-exp ... \ tablename
Table 19-8 nismatch and nisgrep Options
|
To search for a particular value in the first column of a table, simply enter the first column value and a tablename. In nismatch, the value must be a string. In nisgrep, the value must be a regular expression.
nismatch [-h] string tablename nisgrep [-h] reg-expression tablename
This example searches through the depts table for all the entries whose first column has a value of R&D:
rootmaster% nismatch -h `R&D' depts.doc.com. rootmaster% nisgrep -h `R&D' depts.doc.com.
Note - Quotes are used in the 'R&D' expression above to prevent the shell from interpreting the ampersand (&) as a metacharacter.
To search through a particular column other than the first, use the following syntax:
nismatch column=string tablename nisgrep column=reg-expression tablename
This example searches through the depts table for all the entries whose second column has a value of SanFran:
rootmaster% nismatch -h Site=SanFran depts.doc.com. rootmaster% nisgrep -h Site=SanFran depts.doc.com.
To search for entries with matches in two or more columns, use the following syntax:
nismatch [-h] [column=string, ... \ column=string,...],tablename nisgrep [-h] column=reg-exp ... \ tablename
This example searches for entries whose second column has a value of SanFran and whose third column has a value of jhill:
rootmaster% nismatch -h [Site=SanFran,Name=jhill], depts.doc.com. rootmaster% nisgrep -h Site=SanFran Name=jhill depts.doc.com.