Equals
This is a boolean operator that will return true if the LHS is equal to the RHS and false otherwise.
.a == .bIt is most often used with the select operator to find particular nodes:
select(.a == .b)The not equals != operator returns false if the LHS is equal to the RHS.
Related Operators
Match string
Given a sample.yml file of:
- cat
- goat
- dogthen
yq '.[] | (. == "*at")' sample.ymlwill output
Don't match string
Given a sample.yml file of:
then
will output
Match number
Given a sample.yml file of:
then
will output
Don't match number
Given a sample.yml file of:
then
will output
Match nulls
Running
will output
Non existent key doesn't equal a value
Given a sample.yml file of:
then
will output
Two non existent keys are equal
Given a sample.yml file of:
then
will output
Last updated
Was this helpful?