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

append for filters

Append any number of rows to a table.

Signature

> append {flags} (row)

Parameters

  • row: The row, list, or table to append.

Input/output types:

inputoutput
anylist<any>

Examples

Append one int to a list

> [0 1 2 3] | append 4
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 2 │
│ 3 │ 3 │
│ 4 │ 4 │
╰───┴───╯

Append a list to an item

> 0 | append [1 2 3]
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 2 │
│ 3 │ 3 │
╰───┴───╯

Append a list of string to a string

> "a" | append ["b"]
╭───┬───╮
│ 0 │ a │
│ 1 │ b │
╰───┴───╯

Append three int items

> [0 1] | append [2 3 4]
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 2 │
│ 3 │ 3 │
│ 4 │ 4 │
╰───┴───╯

Append ints and strings

> [0 1] | append [2 nu 4 shell]
╭───┬───────╮
│ 0 │     0 │
│ 1 │     1 │
│ 2 │     2 │
│ 3 │ nu    │
│ 4 │     4 │
│ 5 │ shell │
╰───┴───────╯

Append a range of ints to a list

> [0 1] | append 2..4
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 2 │
│ 3 │ 3 │
│ 4 │ 4 │
╰───┴───╯

Notes

Be aware that this command 'unwraps' lists passed to it. So, if you pass a variable to it, and you want the variable's contents to be appended without being unwrapped, it's wise to pre-emptively wrap the variable in a list, like so: append [$val]. This way, append will only unwrap the outer list, and leave the variable's contents untouched.