Community discussions

 
Ehman
Member
Member
Topic Author
Posts: 363
Joined: Mon Nov 15, 2010 10:49 pm

Strip netmask (reversed) .. strip IP

Thu Feb 11, 2016 1:32 am

Hey guys, I've trying to figure this out for the whole day and think its time I ask the pro's!!

I need this script to log info ONLY the subset mask, in this case 24

Help would be super appreciated!

:global ipaddress 10.1.101.1/24

:for i from=( [:len $ipaddress] - 1) to=0 do={ 
	:if ( [:pick $ipaddress $i] = "/") do={ 
		:put [:pick $ipaddress 0 $i]
	} 
}
:global ipaddress 10.1.101.1/24
:put [:pick $ipaddress 0 [:find $ipaddress "/"]]
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5942
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Strip netmask (reversed) .. strip IP

Thu Feb 11, 2016 8:26 am

Easy
[:pick $ipaddress ([:find $ipaddress "/"]+1) [:len $ipaddress] ]
 
Ehman
Member
Member
Topic Author
Posts: 363
Joined: Mon Nov 15, 2010 10:49 pm

Re: Strip netmask (reversed) .. strip IP

Thu Feb 11, 2016 2:22 pm

Easy
[:pick $ipaddress ([:find $ipaddress "/"]+1) [:len $ipaddress] ]
Thx for helping out @ mrz :D +1 ..

Who is online

Users browsing this forum: No registered users and 10 guests