mirror of
https://github.com/wifinigel/MikrotikScripting.git
synced 2025-06-23 01:58:41 +02:00
remove file not incuded in book
This commit is contained in:
parent
e694bc14f9
commit
7b81c76f3f
1 changed files with 14 additions and 0 deletions
14
scripts/v7/ch4-02-ip-prefix-slicer.rsc
Normal file
14
scripts/v7/ch4-02-ip-prefix-slicer.rsc
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# ch4-02-ip-prefix-slicer.rsc
|
||||||
|
|
||||||
|
# Create a function to slice up an IP prefix
|
||||||
|
:global IpPrefixSlicerFunc do={
|
||||||
|
:local InterfaceIp ([/ip/address get $1]->"address");
|
||||||
|
:local SlashPosition [:find $InterfaceIp "/"];
|
||||||
|
:local IpAddress [:pick $InterfaceIp 0 $SlashPosition];
|
||||||
|
:return [:toip $IpAddress]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run the function for ID *1 and verify data type of result
|
||||||
|
:local IpAddress [$IpPrefixSlicerFunc *1];
|
||||||
|
:put ("Result: $IpAddress");
|
||||||
|
:put ("Data type: " . [:typeof $IpAddress]);
|
Loading…
Add table
Add a link
Reference in a new issue