W3cubDocs

/Nushell

get for filters

Extract data using a cell path.

Signature

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

Flags

  • --ignore-errors, -i: ignore missing data (make all cell path members optional)
  • --sensitive, -s: get path in a case sensitive manner

Parameters

  • cell_path: the cell path to the data
  • ...rest: additional cell paths

Input/output types:

input output
list<any> any
record any
table any

Examples

Get an item from a list

> [012] |get1
1

Get a column from a table

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

Get a cell from a table

> [{A:A0}] |get0.A
A0

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

>ls|getname.2

Extract the name of the 3rd record in a list

>ls|get2.name

Extract the cpu list from the sys information record

>sys|getcpu

Getting Path/PATH in a case insensitive way

>$env|getpaTH

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

>$env|get-sPath

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–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/get.html