title: Update a specific object value under YAML based on a condition using yq
body: <p>Using <a href="https://github.com/mikefarah/yq" rel="nofollow noreferrer">https://github.com/mikefarah/yq</a> v4</p>
  <p>Given a <code>sample.yaml</code> file like this:</p>
  <pre><code>spec:
    chart:
      name: my-chart
      version: 0.0.1
  ---
  spec:
    chart:
      name: something-else
      version: 0.0.2
  </code></pre>
  <p>I want to update the <code>version</code> value but only for the instance of <code>.spec.chart.version</code> where the sibling <code>.spec.chart.name</code> element == <code>my-chart</code>.  The result would need to output the entire yaml file so that I can edit the YAML file inline.</p>
  <p>If I use a select like</p>
  <pre><code>yq e -i 'select(.spec.chart.name == &quot;my-chart&quot;) | .spec.chart.version = &quot;1.0.0&quot;' sample.yaml
  </code></pre>
  <p>The second instance of <code>.spec</code> has been removed:</p>
  <pre><code>spec:
    chart:
      name: my-chart
      version: 1.0.0
  </code></pre>
  <p>Any advice?</p>