I am using tinydns and need to dynamicly change some ip in data file. I want to use bash script for it.
For example data file:
+sub1.example.org:282.196.222.245:14400
+sub2.example.org:278.179.280.253:14400
+sub3.example.org:285.117.214.234:14400
bash script has two variables:
old="282.196.222.245"
new="127.0.0.1"
I expect this result:
+sub1.example.org:127.0.0.1:14400
+sub2.example.org:278.179.280.253:14400
+sub3.example.org:285.117.214.234:14400
What is the best way to replace old ip to new (using awk, sed or smth else)?