Home > Net >  yq compare only part of files
yq compare only part of files

Time:03-30

If I have two files, data1.yaml and data2.yaml.

I do not want to compare all conntent of data files. I need to compare only for example version part

---
openapi: 3.0.1
info:
  version: 0.0.1
  title: yaml validation example
  description: >-
    Some description here.

I tried

yq compare data1.yaml data2.yaml

but it compares whole files

CodePudding user response:

May be something like this?

yq eval-all '[.info.version] | .[0] == .[1]' data1.yaml data2.yaml
  • Related