I'm attempting to split a user inputted string that is representing a list of comma separated IP addresses in CIDR notation. In order to determine a wildcard mask later in the script.
eg. 192.168.0.0/24,172.16.0.0/16
#set ($networks = ${networks})
#set ($octets =$networks.split('\,'))
#set ($mask = $octets)
#foreach ($net in $mask)
$net
#end
This outputs:
192.168.0.0/24
172.16.0.0/16
I'm using this currently to create a prefix list which works as expected. However i'd like to also create an ACL from the list which would require determining the Wildcard Mask.
So what I would like to achieve is a way of returning just the list of masks e.g.
24
16
Any tips on how can i achieve this?