From 7b81c76f3f04ee69cec2a08e7a147c99ff435ee3 Mon Sep 17 00:00:00 2001 From: Wifinigel <84858080+nigelbowden@users.noreply.github.com> Date: Sun, 23 Jul 2023 07:25:21 +0100 Subject: [PATCH] remove file not incuded in book --- scripts/v7/ch4-02-ip-prefix-slicer.rsc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 scripts/v7/ch4-02-ip-prefix-slicer.rsc diff --git a/scripts/v7/ch4-02-ip-prefix-slicer.rsc b/scripts/v7/ch4-02-ip-prefix-slicer.rsc new file mode 100644 index 0000000..85df49c --- /dev/null +++ b/scripts/v7/ch4-02-ip-prefix-slicer.rsc @@ -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]); \ No newline at end of file