Get IP Address

We just linked two offices together via wireless. Everything is going great, but I am trying to develop a failover script for the network.

Office 1 has 2 WAN connections (one cable one dsl)
Office 2 has 1 WAN connection (1 cable)

I am currently load balancing at Office 1 using a similar setup to the one posted in the WIKI http://wiki.mikrotik.com/wiki/Load_Balancing_Persistent

I am going to use netwatch to check if the gateways are up. Problem is that in my script i need to get the IP address and alter the src-nat to-addresses when a link goes down.
When I use something like this:

:global CableIP “Not Assigned”
:set CableIP [/ip address get [/ip address find interface=“Cable”] address]
/ip firewall nat set [/ip firewall nat find connection-mark=Even] to-addresses=$CableIP

it will get the IP address but also the netmask in CIDR so CableIP ends up with xxx.xxx.xxx.xxx/xx which of course is invalid in the to-addresses field.

How do I get just the IP address without the netmask included?

$ddns-host address=[:pick $ddns-ip 0 [:find $ddns-ip “/”] ]

Thanks for the help!

I ended up using something like this instead though,

:set CableIP [:pick [/ip address get [/ip address find interface=“Cable”] address] 0 [:find [/ip address get [/ip address find interface=“Cable”] address] “/”]]