0

I have a simple YAML:

host1:
  type: A
  value: 10.0.0.1
host2:
  type: A
  value: 10.0.0.2

which I want to map key-value pairs, like this:

host1: 10.0.0.1
host2: 10.0.0.2

How can I do this using yq?

1 Answer 1

1

Apply .value to all items of the root:

.[] |= .value
# or
map_values(.value)

Works with both kislyuk/yq and mikefarah/yq.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.