I am going to upgrade my network from 64 to 128 IPs. Of course I don't want to change it manually on all 40+ VMs. I plan to use an ansible ad-hoc command with sed -i and then use the same to restart the interfaces. I have tried but and I have found - thank you guys - a solution how to replace the slash in the address, but I still need to carry the last octet of the IP address as a variable into the output. This here works but only partially
Original Text:
address 195.23.154.X/26
What I want:
address 195.34.154.X/25
in /etc/network/interfaces/
My partially-working sed command with escaped slashes:
sed 's/address\ 195.24.153.3\/26/address\ 195.23.154.4\/27/g' interfaces.bak
How do I keep the '3' in this example?
s_/26_/27_
and use an address to apply the command only to the correct line:sed '/address 195.24.153/s_/26_/27_'