get for filters
Signature
> get {flags} (cell_path) ...rest
Flags
--optional, -o: Make all cell path members optional (returnsnullfor 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
1Get 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
A0Extract the name of the 3rd record in a list (same as ls | $in.name.2).
> ls | get name.2Extract the name of the 3rd record in a list.
> ls | get 2.nameGetting 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 pathGetting Path in a case sensitive way, won't work for 'PATH'.
> $env | get PathNotes
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.