Welcome to the Linux Foundation Forum!

Need script or command for addition on extra line with values

Options

Hi All,

I am looking for a scrip or command by which i can generate a additional line with the values in a yml file.

Current i have many such definitions in yml file:

For example:

type: icmp
enabled: true
schedule: "@every 120s"
name: abin0034572
hosts: ["abin0034572.d190.intra"]
ipv4: true
ipv6: false
fields_under_root: true
fields:
snow_cmdb_name: abin0034572
snow_cmdb_uid: SNC.G.P01.010304187
snow_monitor: TRUE
snow_triplet: Application.PaladinNG.Bridge
timeout: 30s
And required output as below:

type: icmp
enabled: true
schedule: "@every 120s"
name: abin0034572
hosts: ["abin0034572.d190.intra"]
ipv4: true
ipv6: false
fields_under_root: true
fields:
snow_cmdb_name: abin0034572
snow_cmdb_uid: SNC.G.P01.010304187121
bridge_enrich_key: SNC.G.P01.010304187121
snow_monitor: TRUE
snow_triplet: Application.PaladinNG.Bridge
timeout: 30s
Need to copy the values from the "snow_cmdb_uid:" and create a new like below it as "bridge_enrich_key: " with values of "snow_cmdb_uid:"

Categories

Upcoming Training