Replies: 3 comments 3 replies
-
This option only works for 2 files. I should have mentioned that I need to process |
Beta Was this translation helpful? Give feedback.
0 replies
-
For 2 files:
For a variable amount of files: #!/bin/bash
args=()
expr=""
arg_i=0
for file in "$@"; do
args+=(--arg "arg${arg_i}" "$(yq -o=json eval "$file")")
expr+=" [\$arg${arg_i} | fromjson] +"
arg_i=$(( arg_i + 1 ))
done
expr="${expr:0: $(( ${#expr} - 2 ))}"
jq "${args[@]}" -n "$expr" |
Beta Was this translation helpful? Give feedback.
1 reply
-
yq ea '[.]' data1.yaml data2.yaml Explanation:
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
a.yaml
:b.yaml
:I would need the output ot be as shown below and the solution to work with
*.yaml
as input:or the yaml equivalent.
Beta Was this translation helpful? Give feedback.
All reactions