I needed to find and replace the ip address in a .ini file. The issue in my previous question was I only needed to change one IP address within a service. Now, I have the same text variable in different service names under the same .ini file. Below are details.
I have the following.
SERVICE_NAME=Test1
SERVICE_L2TP_PEER_IPADDRESS=1.1.1.1
SERVICE_Name=Test2
SERVICE_L2TP_PEER_IPADDRESS=2.2.2.2
It’s the same pattern, but different service name in the same file. The script will locate values above and change 1.1.1.1 to 7.7.7.7 and 2.2.2.2 to 8.8.8.8. I require some help in how to define the service to choose, since both text variables are the same.
Below is the post I used before.