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 
╰───┴────────┴───────╯