Assuming you have something like this in your file my_file
127.0.0.1 192.152.30.1
158.30.254.1 127.0.0.1
158.40.253.10 127.0.0.1
You can try the command line below
sed -r 's/127.0.0.1/########/g;s/[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}/MY_NEW_IP/g;s/########/127.0.0.1/g' my-file
I assume you have nothing like this ########in your file
127.0.0.1 ########, IP-, ip. ######## 127.0.0.1
127.0.0.1 MY_NEW_IP
MY_NEW_IP 127.0.0.1
MY_NEW_IP 127.0.0.1
, ,
sed -r "................................." my_file