-
Let's say I have this file: data:
values: |
foo: bar And another file: john: 42 Can I with yq replace the data:
values: |
john: 42 The closest I've gotten is this: yq ea 'select(fileIndex==0).data.values = select(fileIndex==1) | select(fileIndex==0)' first.yaml second.yaml Which does not result in scalar data: data:
values:
john: 42 |
Beta Was this translation helpful? Give feedback.
Answered by
mikefarah
Jul 20, 2021
Replies: 1 comment 1 reply
-
Because you want to actually put the second file as string contents (rather than actual yaml) you will need to do something like this:
Note that this will have At the moment there is no way that I know of in the underlying go-yaml parser to get '|' |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
p3lim
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because you want to actually put the second file as string contents (rather than actual yaml) you will need to do something like this:
Note that this will have
|-
and not|
this means the trailing newline is _not_included :(At the moment there is no way that I know of in the underlying go-yaml parser to get '|'