flatten
for filters> flatten {flags} ...rest
--all, -a
: flatten inner table one level out...rest
: optionally flatten data by columninput | output |
---|---|
list<any> | list<any> |
record | table |
flatten a table
> [[N, u, s, h, e, l, l]] |flatten
╭───┬───╮
│0│N│
│1│u│
│2│s│
│3│h│
│4│e│
│5│l│
│6│l│
╰───┴───╯
flatten a table, get the first item
> [[N, u, s, h, e, l, l]] |flatten|first
flatten a column having a nested table
> [[origin, people]; [Ecuador, ([[name, meal]; ['Andres', 'arepa']])]] |flatten--all|getmeal
restrict the flattening by passing column names
> [[origin, crate, versions]; [World, ([[name]; ['nu-cli']]), ['0.21', '0.22']]] |flattenversions--all|last|getversions
Flatten inner table
> { a:b, d: [ 1234 ], e: [ 43 ] } |flattend--all
╭───┬───┬───┬───────────╮
│# │ a │ d │ e │
├───┼───┼───┼───────────┤
│0│b│1│╭───┬───╮│
│││││0│4││
│││││1│3││
││││╰───┴───╯│
│1│b│2│╭───┬───╮│
│││││0│4││
│││││1│3││
││││╰───┴───╯│
│2│b│3│╭───┬───╮│
│││││0│4││
│││││1│3││
││││╰───┴───╯│
│3│b│4│╭───┬───╮│
│││││0│4││
│││││1│3││
││││╰───┴───╯│
╰───┴───┴───┴───────────╯
Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/flatten.html