Skip to content

How do I select multiple keys for output?Β #287

@ronniegane

Description

@ronniegane

This seems like a basic question but I can't find examples anywhere in the documentation.
If I have input like

- alpha: 1
  beta: foo
  gamma: 0.3
  delta: bar
- alpha: 2
  beta: baz
  gamma: 1.23
  delta: buzz

And I want to select only the beta and delta keys, so that I get the following output:

- beta: foo
  delta: bar
- beta: baz
  delta: buzz

How do I do it? Every example in the documentation is only selecting a single key.

The equivalent in jq would be something like:

jq '.[] | .beta, .delta'

or

jq '.[] | {beta, delta}'

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions