How can I use bash to replace a string in a file from another file
For example:
There is a path: Hostnameexampleexample.txt
I want to replace the Hostname
with 162 hostnames from another file that contains the 162 hostnames then I save the result.
So the total path should be : 162 paths with different hostnames (162)
The first folder is : Paths.txt ( has 2 paths):
Hostnameexample1example1.txt
Hostnameexample2example2.txt
The Second file is: Hostname.txt ( has 162 hostnames )
I tried :
sed -i 's/Hostname/Hostname.txt/gI' Paths.txt
But the result is :
Hostname.txtexample1example1.txt
Hostname.txtexample2example2.txt
It did not read the real hostname inside the file Hostname.txt