Your claim seems to be contradicting each other. There are two versions of yq
implementations out there. A python implementation as a wrapper over jq
and other written in Go.. See my answer that covers in details about those versions.
When you said you used .[] |= .value
in yq
v2, that's actually not the Go version, but the version with the Python wrapper over jq
, since that syntax matches its DSL. But the other attempt yq w - "*" "*.value"
seems to be the actual Go version.
Since there is an uncertainty around which version of yq
in installed for you, I'll try to provide my view in both the versions
kislyuk's yq
yq -y '.[] |= .value' yaml
mikefarah's yq
The Go version does not have dynamic transformational capabilities like its Python version and does not support this type of update directly. Because the write/new field creations syntax is simply
yq w <yaml_file> <path_expression> <new value>
where the new value is not an expression but a literal value. Had it supported expressions, we could have conjured up a way to do the transformation. The Go version is otherwise good, but lacking support in some key transformational capabilities.
P.S. I've raised a GitHub feature request to allow such transformations. See https://github.com/mikefarah/yq/issues/602
As of today Dec 21st, 2020, yq
v4 is in beta and supports this transformation. Download the v4 version and try
yq eval '.[] |= .value' test.yml