Mass Config Change - Updating mask on all devices

The day has come where I need to expand our management subnet which means I need to update the mask on all our network devices.

The hurdle I need to overcome is being able to use output from the device as a variable to change configuration.

This is on Cisco IOS and Cisco NXOS. The command is pretty simple in concept:

     sh run int vlan 1000 (nxos: show run int mgmt0)

     int {interface}

     ip add {ip address from above output} 255.255.255.128 (nxos: /25)

The trick is A: being able to store that output while the script is running, and B: to parse the IP address out of the output into a variable, and C: being able to call that variable into the running script.