Spec-Zone.ru › Nushell

get for filters

Extract data using a cell path.

Signature

> get {flags} (cell_path) ...rest

Flags

  • --optional, -o: Make all cell path members optional (returns null for missing values).
  • --ignore-case: Make all cell path members case insensitive.
  • --ignore-errors, -i: Ignore missing data (make all cell path members optional) (deprecated).
  • --sensitive, -s: Get path in a case sensitive manner (deprecated).

Parameters

  • cell_path: The cell path to the data.
  • ...rest: Additional cell paths.

Input/output types:

input output
list<any> any
table any
record any
nothing nothing

Examples

Get an item from a list.

> [0 1 2] | get 1
1

Get a column from a table.

> [{A: A0}] | get A
╭───┬────╮
│ 0 │ A0 │
╰───┴────╯

Get a column from a table where some rows don't have that column, using optional cell-path syntax.

> [{A: A0, B: B0}, {B: B1}, {A: A2, B: B2}] | get A?
╭───┬────╮
│ 0 │ A0 │
│ 1 │    │
│ 2 │ A2 │
╰───┴────╯

Get a column from a table where some rows don't have that column, using the optional flag.

> [{A: A0, B: B0}, {B: B1}, {A: A2, B: B2}] | get -o A
╭───┬────╮
│ 0 │ A0 │
│ 1 │    │
│ 2 │ A2 │
╰───┴────╯

Get a cell from a table.

> [{A: A0}] | get 0.A
A0

Extract the name of the 3rd record in a list (same as ls | $in.name.2).

> ls | get name.2

Extract the name of the 3rd record in a list.

> ls | get 2.name

Getting environment variables in a case insensitive way, using case insensitive cell-path syntax.

> $env | get home! path!

Getting environment variables in a case insensitive way, using the '--ignore-case' flag.

> $env | get --ignore-case home path

Getting Path in a case sensitive way, won't work for 'PATH'.

> $env | get Path

Notes

This is equivalent to using the cell path access syntax: $env.OS is the same as $env | get OS.

If multiple cell paths are given, this will produce a list of values.

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

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API