W3cubDocs

/Nushell

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:

input output
list<any> list<any>
table table

Examples

Get rows from table filtered by column uniqueness

> [[fruitcount]; [apple9] [apple2] [pear3] [orange7]] |uniq-byfruit
╭───┬────────┬───────╮
# │ fruit  │ count │
├───┼────────┼───────┤
0apple9
1pear3
2orange7
╰───┴────────┴───────╯

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/uniq-by.html