Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
using yq version 4, how can I edit a specific document of an YAML file which contains several documents? With previous versions I could use the -d argument in combination with -i to edit the file inline while only touching the document at the given index.
This is the shortened input file:
After modifying the file using yq it should look like below (only two lines have been added in the very end):
With yq version 3, I was using the command below to reach the expected result:
yq w -i -d3 input.yml "spec.externalLoadBalancers[+].targetGroupArn" "xyz"
I would prefer to identify the document that should be modified rather by a specific property (i.e. '.spec.role == "Node"') than by using the documentIndex. However, since I haven't found a proper solution yet, I would also go with the documentIndex if it was leading to the expected result.
Beta Was this translation helpful? Give feedback.
All reactions