How can I modify part of an URI in a YAML file using yq? #1870
Unanswered
pauloomarcelo
asked this question in
Q&A
Replies: 1 comment
-
You have to ways First using Second by making a tmp file and then overwrite the original one You yaml does not seem to well-formatted , please update your sample so can be tested sample input transformations:
- template: /pix-bacen/api/v2/pix/
- template: /pix-bacen/api/v2/pix/
- template: /pix-bacssss/api/v2/pix/ Les update the first index [0] yq '.transformations[0].template = "xyz"' file.yaml sample output transformations:
- template: xyz
- template: /pix-bacen/api/v2/pix/
- template: /pix-bacssss/api/v2/pix after testing and seeing the output was correct then you can use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need to update parts of a YAML file, let's say I have this YAML:
transformations:
template: "/pix-bacen/api/v2/pix/
- match_rule: "^/pxxxx/xx/x
template: "/pix-bacen/api/v2/pix/
- match_rule: "^/pxxxx/xx/xxxx
template: "/pix-bacssss/api/v2/pix/
- match_rule: "^/pxxx/xxx/xx
If I want to change just the "/pix-bacen/" part to "/pix-bacen-NEW/", without changing anything else, how should I act? I've tried to use the "with" operator and the "-i" but I just could not figure it out
Beta Was this translation helpful? Give feedback.
All reactions