Skip to content

help adding and deleting nested array elements in v4 #738

@olets

Description

@olets

I'm moving my project git-replay from yq v3 to v4, and am having trouble finding the correct new syntax for two things.

Working with a file like

# myfile.yaml
array_1:
  array_2:
    - array_element_1
    - array_element_2

in v3 I would use

yq d myfile.yaml array_1.array_2.array_element_1

to delete array_element_1 and

yq w myfile.yaml "array_1.array_2[+]" array_element_3

to add array_element_3.

What's the best v4 approach? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions