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 '-' | sort It 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
-
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 thisaid
andrequired=true
cid,cname
I tried following, but it gives a wrong result.
It gives output like following:
cid,cname
Seems, the filter is trying to do
and
operation across the entries rather than within the entries.If I try following, the filtering condition works as expected, but I am unable to fetch
cid
andcname
with this query.Can someone help?
Beta Was this translation helpful? Give feedback.
All reactions