Reputation: 3161
I have a yaml file that I am trying to create a number within a loop and replace it with the newly computed variable.
The line i wish to replace looks like this:
# genesis_gas_limit: "16000000" ## Used to set genesis gas limit
I plan on putting this in a loop and thus I would love it if the sed could take a wild card i.e.
# genesis_gas_limit: "*" ## Used to set genesis gas limit
I have have tried this
sed -i 's/ genesis_gas_limit:/c\ genesis_gas_limit: $GASLIMIT' examples/values-local.yaml
but i get the following error:
sed: 1: "examples/values-local.yaml": invalid command code e
I would appreciate any pointers on this
Upvotes: 2
Views: 525
Reputation: 124804
You could replace genesis_gas_limit:
and whatever content follows it, with genesis_gas_limit:
and the new value. Using GNU sed:
sed -i "s/ genesis_gas_limit:.*/ genesis_gas_limit: \"$GASLIMIT\"/" examples/values-local.yaml
Using BSD sed (in OSX):
sed -i.bak -e "s/ genesis_gas_limit:.*/ genesis_gas_limit: \"$GASLIMIT\"/" examples/values-local.yaml
Upvotes: 1