Solaris Naming Administration Guide

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.