命令行大全

nisgrep

瑞兹 发表于 2021-02-08 09:08浏览次数:

在Solaris操作系统上,nismatch和nisgrep是用于搜索NIS +表的实用程序。

查看英文版

目录:

1 nisgrep 运行系统环境

2 nisgrep 描述

3 nisgrep 语法

4 nisgrep 例子

nisgrep 运行系统环境

Unix&Linux

nisgrep 描述

nismatchnisgrep实用程序可用于搜索NIS +表。该命令nisgrep从不同nismatch中的命令在其接受能力正则表达式 keypat为搜索条件,而不是简单的文本匹配。

由于nisgrep使用回调函数,因此它不限于仅搜索那些在创建表时明确可搜索的列。这使其比nismatch更灵活,但速度更慢。

nismatch中,服务器进行搜索,而在nisgrep中,服务器返回所有可读条目,然后客户端进行模式匹配。

在这两个命令中,参数 tablename是要搜索的表的NIS +名称。如果仅指定一个键或键模式而不指定列名,则将其应用于搜索第一列。可以使用colname key语法搜索特定的命名列。搜索多列时,仅返回所有列中匹配的条目。这等效于逻辑联接操作。

nismatch接受另一种搜索条件形式indexedname,它是该形式的NIS +索引名称:

[ colname=value, ... ],tablename

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 an NIS+ indexed name of the form:

[ colname=value, ... ],tablename

查看英文版

查看中文版

nisgrep 语法

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 所有数据。返回表中的数据以及初始表的串联 路径中表中的所有数据。
-C 仅打印符合搜索条件的条目数的计数。
-h 在包含表列名称的匹配条目之前显示标题行。
-i 在比较过程中,忽略大小写区分。
-M 仅主服务器。将查找发送到命名数据的主服务器。这样可以确保查看最新信息,而主服务器可能会很忙。
-o 显示匹配的NIS +对象的内部表示。
-P 遵循串联路径。指定如果初始搜索失败,则查找应遵循表的串联路径。
-s sep 此选项指定用于分隔表列的字符。如果未指定任何字符,则使用表的默认分隔符。
-v 详细操作。显示匹配条目时,请勿抑制二进制数据的输出。如果没有此选项,二进制数据将显示为字符串“ * BINARY * ”。

环境

如果设置了NIS_PATH 环境变量,并且NIS +表名不是完全限定的,则将搜索指定的每个目录,直到找到该表为止(请参见nisdefaults)。

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

Options

-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*".

Environment

If the NIS_PATH environment variable is set, and the NIS+ table name is not fully qualified, each directory specified will be searched until the table is found (see nisdefaults).

查看英文版

查看中文版

nisgrep 例子

nismatch name=skippy passwd.org_dir.zotz.com.

zotz.comorg_dir子目录中搜索名为passwd的表。域。它返回用户名为skippy的条目。所有工作都在服务器上完成。

nisgrep 'shell=[ck]sh' passwd.org_dir.zotz.com.

与上面的示例类似,除了在passwd表中搜索名为skippy的用户之外,它会在该表中搜索默认外壳程序为cshksh的任何用户。

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.

Like the above example, except instead of searching the passwd table for a user named skippy, it searches it for any user whose default shell is either csh or ksh.

查看英文版

查看中文版

发表评论
评论列表
共0条
点击加载更多