"Following from the example above`.[]` splats the array, selects filters the items.",
"We then pipe (`|`) that into `.numBuckets`, which will select that field from all the matching items",
"Splat, select and the field are all in brackets, that whole expression is passed to the `|=` operator as the left hand side expression, with `. + 1` as the right hand side expression.",
"`|=` is the operator that updates fields relative to their own value, which is referenced as dot (`.`).",
"The expression `. + 1` increments the numBuckets counter.",
"See the [assign](https://mikefarah.gitbook.io/yq/operators/assign-update) and [add](https://mikefarah.gitbook.io/yq/operators/add) operators for more information.",
"The with operator will effectively loop through each given item in the first given expression, and run the second expression against it.",
"`.myArray[]` splats the array in `myArray`. So `with` will run against each item in that array",
"`.name = .name + \" - \" + .type` this expression is run against every item, updating the name to be a concatenation of the original name as well as the type.",
"See the [with](https://mikefarah.gitbook.io/yq/operators/with) operator for more information and examples.",
"`.[] | select(.type == \"foo\") | .names` will select the array elements of type \"foo\"",
"Splat `.[]` will unwrap the array and match all the items. We need to do this so we can work on the child items, for instance, filter items out using the `select` operator.",
"But we still want the final results back into an array. So after we're doing working on the children, we wrap everything back into an array using square brackets around the expression. `[.[] | select(.type == \"foo\") | .names]`",
"Now have have an array of all the 'names' values. Which includes arrays of strings as well as strings on their own.",
"Pipe `|` this array through `flatten`. This will flatten nested arrays. So now we have a flat list of all the name value strings",
"Next we pipe `|` that through `sort` and then `unique` to get a sorted, unique list of the names!",
"See the [flatten](https://mikefarah.gitbook.io/yq/operators/flatten), [sort](https://mikefarah.gitbook.io/yq/operators/sort) and [unique](https://mikefarah.gitbook.io/yq/operators/unique) for more information and examples.",
description:"Export as environment variables (script), or any custom format",
subdescription:"Given a yaml document, lets output a script that will configure environment variables with that data. This same approach can be used for exporting into custom formats.",
subdescription:"Like the previous example, but lets handle nested data structures. In this custom example, we're going to join the property paths with _. The important thing to keep in mind is that our expression is not recursive (despite the data structure being so). Instead we match _all_ elements on the tree and operate on them.",
"You'll need to understand how the previous example works to understand this extension.",
"`..` matches _all_ elements, instead of `.[]` from the previous example that just matches top level elements.",
"Like before, we need a string expression for each of the different types that will produce the bash syntax, we'll use the union operator, to join them together",
"This time, however, our expression matches every node in the data structure.",
"We only want to print scalars that are not in arrays (because we handle the separately), so well add `and parent | kind != \"seq\"` to the select operator expression for scalars",
"We don't just want the key any more, we want the full path. So instead of `key` we have `path | join(\"_\")`",
"The expression for sequences follows the same logic",