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:
input | output |
---|---|
record | record |
table | table |
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 │
╰───────┴─────╯