[question][solved]: how do I add to an array contents from another file #1329
Answered
by
mikefarah
luntik2012
asked this question in
Q&A
-
src: _anchors_:
- &_test 123 dst: _anchors_:
- &_test 123
- $_myVar |
multilineCertFromFileLine0
multilineCertFromFileLine1
multilineCertFromFileLine2 |
Beta Was this translation helpful? Give feedback.
Answered by
mikefarah
Sep 8, 2022
Replies: 1 comment 1 reply
-
Note: Please raise future how to questions under discussion please :) yq '._anchors_ += loadstr("cert.txt") | (._anchors_[-1] anchor="_myVar")' data.yaml Explanation:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
luntik2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: Please raise future how to questions under discussion please :)
yq '._anchors_ += loadstr("cert.txt") | (._anchors_[-1] anchor="_myVar")' data.yaml
Explanation:
_anchors_
array:._anchors_ =+ (blah)
loadstr("cert.txt")
(._anchors_[-1] anchor="_myVar")