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

uniq-by for filters

Return the distinct values in the input by the given column(s).

Signature

> uniq-by {flags} ...rest

Flags

  • --count, -c: Return a table containing the distinct input values together with their counts
  • --repeated, -d: Return the input values that occur more than once
  • --ignore-case, -i: Ignore differences in case when comparing input values
  • --unique, -u: Return the input values that occur once only

Parameters

  • ...rest: The column(s) to filter by.

Input/output types:

inputoutput
list<any>list<any>
tabletable

Examples

Get rows from table filtered by column uniqueness

> [[fruit count]; [apple 9] [apple 2] [pear 3] [orange 7]] | uniq-by fruit
╭───┬────────┬───────╮
│ # │ fruit  │ count │
├───┼────────┼───────┤
│ 0 │ apple  │     9 │
│ 1 │ pear   │     3 │
│ 2 │ orange │     7 │
╰───┴────────┴───────╯