Having real trouple searching this one up.. as the search terms are 2 letters or operators that aren’t accepted by the Forum.
Trying to write a script that does a Find for OR . In this instance, trying to use the same variable, just with different values.
test script is
[/foreach count in=[/interface find name!=ether5] do={:put [/interface get value-name=name number=$count] }]
This produces an output where it finds all interfaces and outputs them in terminal, unless it is named ether5.
[/foreach count in=[/interface find name!=ether5 name~"(ether|sfp|combo)"] do={:put [/interface get value-name=name number=$count] }]
This one produces similar output, but instead of printing all interfaces, only prints ones with names similar to ether, sfp or combo (general ethernet interfaces in Mikrotik).
The problem I have is that I want to have multiple “name!=ether5” entires, but at this time have to have multiple entires. I would have expected “&&” (and) and “||” (or) to work with the operation, but cannot get the desired output. Usually it results in the “not” variable failing.
e.g of code that works…
[/foreach count in=[/interface find name!=ether5 name!=ether2 name~"(ether|sfp|combo)"] do={:put [/interface get value-name=name number=$count] }]
This does as required - but having multiple != is really Yuck.
e.g of what I would expect to work
[/foreach count in=[/interface find name!="ether5"||"ether2" name~"(ether|sfp|combo)"] do={:put [/interface get value-name=name number=$count] }]
or
[/foreach count in=[/interface find name!="(ether5|ether2)" name~"(ether|sfp|combo)"] do={:put [/interface get value-name=name number=$count] }]
So, My question is if there is any way to “or” a “find” command, without having to fully script out the != multiple times per line. Trying to get it to a point where I can potentially array a script using similar code.
As you can well see here - the
name~"(ether|sfp|combo)"
is already a type of “or” for this - but just cannot get anything similar for “not”