Linux nismatch and nisgrep
About nismatch and nisgrep
On Solaris, nismatch and nisgrep are utilities for searching NIS+ tables.
The utilities nismatch and nisgrep can be used to search NIS+ tables. The command nisgrep differs from the nismatch command in its ability to accept regular expressions keypat for the search criteria rather than simple text matches.
Because nisgrep uses a callback function, it is not constrained to searching only those columns that are specifically made searchable at the time of table creation. This makes it more flexible, but slower, than nismatch.
In nismatch, the server does the searching, whereas in nisgrep the server returns all the readable entries and then the client does the pattern-matching.
In both commands, the parameter tablename is the NIS+ name of the table to be searched. If only one key or key pattern is specified without the column name, then it is applied searching the first column. Specific named columns can be searched by using the colname=key syntax. When multiple columns are searched, only entries that match in all columns are returned. This is the equivalent of a logical join operation.
nismatch accepts an additional form of search criteria, indexedname, which is a NIS+ indexed name of the form:
[ colname=value, ... ],tablename
nismatch and nisgrep syntax
nismatch [-AchMoPv] [-s sep] key tablename
nismatch [-AchMoPv] [-s sep] colname = key... tablename
nismatch [-AchMoPv] [-s sep] indexedname
nisgrep [-AchiMov] [-s sep] keypat tablename
nisgrep [-AchiMov] [-s sep] colname = keypat... tablename
|-A||All data. Return the data within the table and all of the data in tables in the initial table's concatenation path.|
|-c||Print only a count of the number of entries that matched the search criteria.|
|-h||Display a header line before the matching entries that contains the names of the table's columns.|
|-i||Ignore upper/lower case distinction during comparisons.|
|-M||Master server only. Send the lookup to the master server of the named data. This guarantees that the most up to date information is seen at the possible expense that the master server may be busy.|
|-o||Display the internal representation of the matching NIS+ object(s).|
|-P||Follow concatenation path. Specify that the lookup should follow the concatenation path of a table if the initial search is unsuccessful.|
|-s sep||This option specifies the character to use to separate the table columns. If no character is specified, the default separator for the table is used.|
|-v||Operate verbosely. Do not suppress the output of binary data when displaying matching entries. Without this option binary data is displayed as the string "*BINARY*".|
nismatch and nisgrep examples
nismatch name=skippy passwd.org_dir.zotz.com.
Searches a table named passwd in the org_dir subdirectory of the zotz.com. domain. It returns the entry that has the username of skippy. All the work is done on the server.
nisgrep 'shell=[ck]sh' passwd.org_dir.zotz.com.