Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

move for filters

Moves columns relative to other columns or make them the first/last columns. Flags are mutually exclusive.

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
  • --first: makes the columns be the first ones
  • --last: makes the columns be the last ones

Parameters

  • ...rest: The columns to move.

Input/output types:

inputoutput
recordrecord
tabletable

Examples

Move a column before the first column

> [[name value index]; [foo a 1] [bar b 2] [baz c 3]] | move index --before name
╭───┬──────┬───────╮
│ # │ name │ value │
├───┼──────┼───────┤
│ 1 │ foo  │ a     │
│ 2 │ bar  │ b     │
│ 3 │ baz  │ c     │
╰───┴──────┴───────╯

Move multiple columns after the last column and reorder them

> [[name value index]; [foo a 1] [bar b 2] [baz c 3]] | move value name --after index
╭───┬───────┬──────╮
│ # │ value │ name │
├───┼───────┼──────┤
│ 1 │ a     │ foo  │
│ 2 │ b     │ bar  │
│ 3 │ c     │ baz  │
╰───┴───────┴──────╯

Move columns of a record

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