Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
19.  Administering NIS+ Tables Removing Table Entries  Previous   Contents   Next 
   
 

Removing Single Table Entries

To remove a single entry from a table, use the -r option:

nistbladm -r indexed-name

This example removes the Manf-1 entry from the depts table:

rootmaster% nistbladm -r [Dept=Manf-1,Site=Emeryville,Name=hosteen],\
depts.doc.com.

You can specify as few column values as you wish. If NIS+ finds duplicates, it does not remove any entry and returns an error message instead. Thus, you could have removed the Manf-1 by specifying only the Site column value, as in this example:

rootmaster% nistbladm -r [Site=Emeryville],depts.doc.com.

However, you could not have removed the Sales entry by specifying only the Site column value (SanFran), because two entries have that same value (R&D and Sales):

Dept

Site

Name

R&D

SanFran

kuznetsov

Sales

SanFran

jhill

Manf-1

Emeryville

hosteen

Manf-2

Sausalito

lincoln

Removing Multiple Entries From a Table

To remove multiple entries from a table, use the -R option:

nistbladm -R indexedname

As with the -r option, you can specify as few column values as you wish. Unlike the -r option, however, if NIS+ finds duplicates, it removes all of them. You can find the name of a table's column by using the niscat -o command. This example removes all entries in which the Site is SanFran:

rootmaster% nistbladm -R [Site=SanFran],depts.doc.com.

Dept

Site

Name

Manf-1

Emeryville

hosteen

Manf-2

Sausalito

lincoln

You can use the -R option to remove all the entries from a table. Simply do not specify any column values between the square brackets, as in this example:

rootmaster% nistbladm -R [],depts.doc.com.

When used with the nistbladm -R command, an empty set of square brackets is interpreted as a wildcard specifying all table rows.

The niscat Command

The niscat command displays the contents of an NIS+ table. However, you can also use it to display the object properties of the table. You must have read rights to the table, entries, or columns that you wish to display.

Syntax

To display the contents of a table, use:

niscat [-hM] tablename

To display the object properties of a table, use:

niscat -o tablename
niscat -o entry

Table 19-5 niscat Options

Option

Description

-h

Header. Displays a header line above the table entries, listing the name of each column.

-M

Master. Displays only the entries of the table stored on the Master server. This ensures you get the most up-to-date information and should be used only for debugging.

-o

Object. Displays object information about the table, such as column names, properties, and servers.

Displaying the Contents of a Table

To display the contents of a table, use niscat with a table name:

niscat tablename

This example displays the contents of the table named depts.

rootmaster% niscat -h depts.doc.com.
#Name:Site:Name
R&D:SanFran:kuznetsov
Sales:SanFran:jhill
Manf-1:Emeryville:hosteen
Manf-2:Sausalito:lincoln

Note - The symbol *NP* indicates that you do not have permission to view that entry. Permissions are granted on a table, column, or entry (row) basis. For more on access permissions, see Chapter 15, Administering NIS+ Access Rights.


Displaying the Object Properties of a Table or Entry

To list the object properties of a table, use niscat -o and the table's name:

niscat -o tablename.org_dir

To display the object properties of a table entry, use niscat -o and specify the entry with an indexed name:

entry ::=column=value \
 ... tablename | \
 [column=value,...],\
 tablename

Here are two examples, one for a table and one for a table entry:

Table

rootmaster# niscat -o hosts.org_dir.doc.com.
Object Name : hosts
Owner : rootmaster.doc.com.
Group : admin.doc.com.
Domain : org_dir.doc.com.
Access Rights : ----rmcdr---r---
Time to Live : 12:0:0
Object Type : TABLE
Table Type : hosts_tbl
Number of Columns : 4
Character Separator :
Search Path :
Columns :
 [0] Name : cname
 Attributes : (SEARCHABLE, TEXTUAL DATA, CASE INS
 Access Rights: ----------------
 [1] Name : name
 Attributes : (SEARCHABLE, TEXTUAL DATA, CASE INS
 Access Rights: ----------------
 [2] Name : addr
 Attributes : (SEARCHABLE, TEXTUAL DATA, CASE INS
 Access Rights: ----------------
 [3] Name : comment
 Attributes : (TEXTUAL DATA)
 Access Rights: ----------------

Table entry

rootmaster# niscat -o [name=rootmaster],hosts.org_dir.doc.com.
Object Name : hosts
Owner : rootmaster.doc.com.
Group : admin.doc.com.
Domain : org_dir.doc.com.
Access Rights : ----rmcdr---r---
Time to Live : 12:0:0
Object Type : ENTRY
 Entry data of type hosts_tbl
 Entry has 4 columns.
 .
#

The nismatch and nisgrep Commands

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

Characteristics

nismatch

nisgrep

Search criteria

Accepts text only

Accepts regular expressions

Speed

Faster

Slower

Searches through

Searchable columns only

All columns, whether searchable or not

Syntax of search criteria

column=string ... tablename[ column= string,...], tablename

column=exp ... tablename

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.

Name (S)

Site (S)

Name

R&D

SanFran

kuznetsov

Sales

SanFran

jhill

Manf-1

Emeryville

hosteen

Manf-2

Sausalito

lincoln

Shipping-1

Emeryville

tsosulu

Shipping-2

Sausalito

katabami

Service

Sparks

franklin

 
 
 
  Previous   Contents   Next