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

merge for filters

Merge the input with a record or table, overwriting values in matching columns.

Signature

> merge {flags} (value)

Parameters

  • value: The new value to merge with.

Input/output types:

inputoutput
recordrecord
tabletable

Examples

Add an 'id' column to the input table

> [a b c] | wrap name | merge ( [47 512 618] | wrap id )
╭───┬──────┬─────╮
│ # │ name │ id  │
├───┼──────┼─────┤
│ 0 │ a    │  47 │
│ 1 │ b    │ 512 │
│ 2 │ c    │ 618 │
╰───┴──────┴─────╯

Merge two records

> {a: 1, b: 2} | merge {c: 3}
╭───┬───╮
│ a │ 1 │
│ b │ 2 │
│ c │ 3 │
╰───┴───╯

Merge two tables, overwriting overlapping columns

> [{columnA: A0 columnB: B0}] | merge [{columnA: 'A0*'}]
╭───┬─────────┬─────────╮
│ # │ columnA │ columnB │
├───┼─────────┼─────────┤
│ 0 │ A0*     │ B0      │
╰───┴─────────┴─────────╯

Notes

You may provide a column structure to merge

When merging tables, row 0 of the input table is overwritten with values from row 0 of the provided table, then repeating this process with row 1, and so on.

Subcommands:

namedescriptiontype
merge deepMerge the input with a record or table, recursively merging values in matching columns.built-in