Find a network for an ip address which you don't know

Hi!
I need to find a network for an ip address, but:

  • I know this ip address is 192.168.1. ? or 192.168.2. ? , so i don’t know the last part of the address.
    If i have the full ip address i can get a network like this
:local ipnetwork [/ip address get [find address="192.168.1.1/32"] network];

but if i have a missing part, what can i do for make the problem solved?

And probably in this router have a 192.168.1.1/32 and i want to found another one, so i think this ~ symbol isn’t enough
like this:

:local address [/ip address get [find address~"192.168."] address];

Where do you find the partial address 192.168.1. ?
What gives this type of output?

:smiley: I thinked i solved it but :smiley: nop
In this company where i’m a trainee have a lot of router and stuff and i don’t have access for all of them, but i must to write scripts for them. My boss said they are in a /22 masked network and if 192.168.1.1 and one another 192.168.1-4.? ip address have the router than the script need to run. But there is my solution:

:local address [/ip address get [find address~"192.168." and address!="192.168.1.1"] address];

but it can’t be good becouse it have the “invalid internal item number” so if someone have a good idea :slight_smile:

Oh i forgot the netmask from the end of the ip address so this can be good, if someone need this anytime :smiley:

:local address2 [/ip address get [find (address~"192.168.1." or address~"192.168.2.") and address!="192.168.1.1/32"] address];