W3cubDocs

/Nushell

move for filters

Move columns before or after other columns.

Signature

> move {flags} ...rest

Flags

  • --after, - {string}: the column that will precede the columns moved
  • --before, - {string}: the column that will be the next after the columns moved

Parameters

  • ...rest: the columns to move

Input/output types:

input output
record record
table table

Examples

Move a column before the first column

> [[namevalueindex]; [fooa1] [barb2] [bazc3]] |moveindex--beforename
╭───┬──────┬───────╮
│# │ name │ value │
├───┼──────┼───────┤
│1│foo│a│
│2│bar│b│
│3│baz│c│
╰───┴──────┴───────╯

Move multiple columns after the last column and reorder them

> [[namevalueindex]; [fooa1] [barb2] [bazc3]] |movevaluename--afterindex
╭───┬───────┬──────╮
│# │ value │ name │
├───┼───────┼──────┤
│1│a│foo│
│2│b│bar│
│3│c│baz│
╰───┴───────┴──────╯

Move columns of a record

> { name:foo, value:a, index:1 } |movename--beforeindex
╭───────┬─────╮
│value│a│
│name│foo│
│index│1│
╰───────┴─────╯

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