Replies: 1 comment
-
|
I found the answer myself. yq e '. | select(.func.apis.[] | (.aid == “id1234" and .required == "true")) | [.cid,.cname] | @csv' *.yaml | grep -v '^$' | grep -v '-' | sortIt gives the required output. cid,cname |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have set of yaml files, each containing a structure and content like following.
(file-1.yaml)
(file-2.yaml)
(file-n.yaml)
I wish to crease a csv of entries like this: for a given aid (say
id1234), filter across files and fetch those which match thisaidandrequired=truecid,cname
I tried following, but it gives a wrong result.
It gives output like following:
cid,cname
Seems, the filter is trying to do
andoperation across the entries rather than within the entries.If I try following, the filtering condition works as expected, but I am unable to fetch
cidandcnamewith this query.Can someone help?
Beta Was this translation helpful? Give feedback.
All reactions