finde and where examples

I'm playing with find and where but I'm missing something.

#works

/ip route print  where dst-address="0.0.0.0/0"

don't work

/ip route find  where dst-address="0.0.0.0/0"
/ip route find  dst-address="0.0.0.0/0"

Aim is to search for comments by using wildcards.

Do I miss something?

Hello,

Use find command to make an action, like:

/ip route set [find dst-address=0.0.0.0/0] distance=250

Above, you’ll set distance 250 to static routes with dst-address 0.0.0.0/0.

To search, you’re right with:

/ip route print  where dst-address="0.0.0.0/0"

And if you want to add more parameters, you may use “and”:

/ip route print where dst-address="0.0.0.0/0" and comment="static-route-1"

@Pietro thank you for help.

find

is there a way to test find output on CLI before you start changing something or using in script?
Just to check if your query is right.

where and regex

I have tried to use regex but it looks id doesn't work or I'm missing something.

work

/ip route print where comment="location1-server1"

don't work

/ip route print where comment="location1-.*"

but I have found this and it works

1. /ip route print where comment~"location1"
2. /ip route print where comment~"location1" = false  - list all except what contain location1
3. /ip route print where comment~"location1" = true  - same as 1.

Regards,
Darko Bazulj