W3cubDocs

/Nushell

collect for filters

Collect the stream and pass it to a block.

Signature

> collect {flags} (closure)

Flags

  • --keep-env, -: let the block affect environment variables

Parameters

  • closure: the closure to run once the stream is collected

Input/output types:

input output
any any

Examples

Use the second value in the stream

> [123] |collect { |x| $x.1 }
2

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/collect.html