uniq-by for filters

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

Signature

> uniq-by ...rest --count --repeated --ignore-case --unique

Parameters

  • ...rest: the column(s) to filter by
  • --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

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