Forum Discussion

CTS_14402's avatar
CTS_14402
Icon for Nimbostratus rankNimbostratus
Nov 19, 2004

How to use findclass?

Hello,

 

 

I wrote the following rule.

 

However the rule do not output anything.

 

How to use the "findclass()" command?

 

 

log [getfield [findclass "abc" test-class] " " 2]

 

 

The type of "test-class" is string.

 

And the contents is

 

 

abc 192.168.1.1

 

def 192.168.1.2

 

ghi 192.168.1.3

 

 

Regards.

4 Replies

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    I'd like to add that there is a shortcut to using getfield with findclass.

    findclass takes an optional 3rd argument which is the separator. When the class item is matched the separator will split the class and the trailing portion will be returned.

    In example, these are equivalent:

     
     set foo [getfield [findclass "something" $::my_class] " " 2] 
     

     
     set foo [findclass "something" $::my_class " "]