I have a file config.txt which consist of lines like below
$ cat config.txt | head -n 3
[email protected]:26601
[email protected]:26604
[email protected]:26607
$ cat ip.txt | head -n 3
10.0.4.5
10.3.5.6
10.3.5.8
I would like to replace the IP address on config.txt with ip's on ip.txt file respectively
the expected output is
[email protected]:26601
[email protected]:26604
[email protected]:26607
Since the ip's in config file are dynamic, I need to use regex in sed to replace the IP. for an example:
$ echo "[email protected]:26601" | sed "s/*@\+:*/*@10.0.4.5:*/g"
but its not updating the ip's. I am very new to the regex in scripting. Kindly help!
head -n3 config.txt, btw.