Solaris Naming Administration Guide

Examining Attributes

Search for attributes with the fnsearch command.

The syntax of the fnsearch command is


fnsearch [-ALlv] [-n max] [-s scope] name [-a ident]... [-O|-U] filter_expr [filter_arg]
Table 27-1 fnsearch Command Options

Option 

Description 

-n max

Display only max number of objects. 

-s scope

Set the scope of the search 

-a ident

Display only those attributes that match ident. 

name

Composite name 

filter_expr

Boolean, logical, grouping, relational, and comparison operators (see Table 27-2)

filter_arg

Arguments for filter expressions (see Table 27-2]

-A

Consult only the authoritative source. 

-L

Follow XFN links. 

-l

Display the object references for the matching objects. 

-v

Verbose. Display detailed object references for the matching objects. 

-O

Use an OSI OID as the identifier 

-U

Use a DCE UUID as the identifier 

Searching for Objects Associated With an Attribute

With the fnsearch command, you can search for objects that are associated with the attributes you choose.

For example, to find all the objects that are associated with the attribute for_sale in orgunit/sales/site/, you would enter the following command:


 % fnsearch orgunit/sales/site/ for_sale

Customizing Attribute Searches

You can also use all the following in filter expressions in your search patterns.

Table 27-2 fnsearch Filter Expression Operators

Filter Expression Operator 

Symbols and Forms 

Logical operators 

or, and, not

Parentheses for grouping 

( )

Relational operators: Compare an attribute to a supplied value 

== True if at least one attribute value is equal to the supplied value. != True if none of the attribute values are equal to the supplied value. < True if at least one attribute value is less than the supplied value. <= True if at least one attribute value is less than or equal to the supplied value. > True if at least one attribute value is greater than the supplied value. >= True if at least one attribute value is greater than or equal to the supplied value. ~= True if at least one attribute value matches the supplied value according to some context-specific approximate matching criterion. This criterion must subsume strict equality.

Example: 

% fnsearch name "not (make == 'olds' and year == 1983)"

Substitution tokens: 

Helpful when writing shell scripts; allow the use of OSI OIDs and DCE UUIDs when used with the -O and -U options

%a for attribute

%s for string

%i for identifier

%v for attribute value (only fn_attr_syntax_ascii is currently supported)

Example: 

The following three examples are equivalent. 

% fnsearch name "color == 'red'"

% fnsearch name "%a == 'red'" color

% fnsearch name "%a == %s" color red

Wild card strings 

*, *string, string*, str*ing, %s*

Extended operators 

'name'(wildcarded_string), 'reftype'(identifier), 'addrtype' (identifier)

Example: 

Search for objects with names starting with "Bill" and IQ attributes over 80. 

% fnsearch name "'name'('bill'*) and IQ > 80"

See the fnsearch man page for detailed information about creating search patterns.