AnsweredAssumed Answered

Mass configuration file modification

Question asked by Bernhard Sayer on Jan 24, 2018
Latest reply on Feb 2, 2018 by Bernhard Sayer

Hi!

 

I want to create a mass configuration file for adding new host objects with different values and fitting name conventions.

In following configuration line, the variables "AAAAA", "BBBB", "XYZ" and "WWWWWW" should be replaced with values from a CSV oder text file:

add host name "AAAAA-node-svBBBBvh01" ip-address "10.XYZ.0.8" color "WWWWWW" groups.1 "Group-Vcenter"

 

The result should be like this:

add host name "G1AT1-node-svAT1vh01" ip-address "10.50.0.8" color "Red" groups.1 "Group-Vcenter"
add host name "G1AT2-node-svAT2vh01" ip-address "10.51.0.8" color "Red" groups.1 "Group-Vcenter"
add host name "G2DE1-node-svDE1vh01" ip-address "10.66.0.8" color "Blue" groups.1 "Group-Vcenter"
add host name "G2FR1-node-svFR1vh01" ip-address "10.67.0.8" color "Blue" groups.1 "Group-Vcenter"
add host name "G3US1-node-svUS1vh01" ip-address "10.99.0.8" color "Orange" groups.1 "Group-Vcenter"
add host name "G3CN1-node-svCN1vh01" ip-address "10.98.0.8" color "Orange" groups.1 "Group-Vcenter"
...

 

I know how to create a bash script, which changes one variable like the following in a loop. But i have no idea how to adapt this to meet my multi variable change requirement.

  while read p; do
    blabla $p
 done < table.txt

 

Thanks in advance,

Bernhard

Outcomes