I have below yaml file and I am trying to get all key value pairs if abc
string is present in values.
a: abcsdf
b: hyuabc
c: iopabc
d: mnhbvgc
Expected output:
a: abcsdf
b: hyuabc
c: iopabc
My Attempt:
yq eval '.[] | select(. == "*abc*") test.yaml
It is really weird, the select
and del
functions in work totally different. While select returns the result of the filter as the array elements, delete returns the map
yq eval 'del( .[] | select( . != "*abc*" ) )' yaml