cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1882
Views
0
Helpful
1
Replies

EEM compare string not working

ez9
Level 1
Level 1

Hello,

I tried to create an eem applet where i want to compare a string value with the content of a file in flash. My applet is below:

event manager applet TEST
event none
action 1.0 cli command "enable"
action 1.3 cli command "more flash:test | include teststring"
action 1.5 string equal "teststring" "$_cli_result"
action 1.6 if $_string_result eq "1"
action 1.6.1 syslog msg "Success"
action 1.7 end


In file i have only the word 'teststring' but the Success syslog message never logged....

i tried also to match my strings with if statement (without string equal) but without success.

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

When you use CLI to gather data, the result will never just be one word (or one line).  Try this code instead:

action 1.5 regexp "teststring" "$_cli_result"

action 1.6 if $_regexp_result eq "1"

...

Review Cisco Networking for a $25 gift card