mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 22:57:58 +02:00
Auto-generate markdown command docs (#4451)
* Finish updating * a couple improvements * Update renames * cleanup examples
This commit is contained in:
@ -1,50 +1,46 @@
|
||||
# uniq
|
||||
---
|
||||
title: uniq
|
||||
layout: command
|
||||
version: 0.59.0
|
||||
---
|
||||
|
||||
Returns unique rows or values from a dataset.
|
||||
Return the unique rows.
|
||||
|
||||
## Signature
|
||||
|
||||
```> uniq --count --repeated --ignore-case --unique```
|
||||
|
||||
## Parameters
|
||||
|
||||
- `--count`: Count the unique rows
|
||||
- `--repeated`: Count the rows that has more than one value
|
||||
- `--ignore-case`: Ignore differences in case when comparing
|
||||
- `--unique`: Only return unique values
|
||||
|
||||
## Examples
|
||||
|
||||
Given a file `test.csv`
|
||||
|
||||
```csv
|
||||
first_name,last_name,rusty_at,type
|
||||
Andrés,Robalino,10/11/2013,A
|
||||
Andrés,Robalino,10/11/2013,A
|
||||
Jonathan,Turner,10/12/2013,B
|
||||
Yehuda,Katz,10/11/2013,A
|
||||
```
|
||||
|
||||
Remove duplicate rows of a list/table
|
||||
```shell
|
||||
> `open test.csv | uniq`
|
||||
━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━
|
||||
# │ first_name │ last_name │ rusty_at │ type
|
||||
───┼────────────┼───────────┼────────────┼──────
|
||||
0 │ Andrés │ Robalino │ 10/11/2013 │ A
|
||||
1 │ Jonathan │ Turner │ 10/12/2013 │ B
|
||||
2 │ Yehuda │ Katz │ 10/11/2013 │ A
|
||||
━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━
|
||||
> [2 3 3 4] | uniq
|
||||
```
|
||||
|
||||
Only print duplicate lines, one for each group
|
||||
```shell
|
||||
> `open test.csv | get type | uniq`
|
||||
━━━┯━━━━━━━━━
|
||||
# │
|
||||
───┼─────────
|
||||
0 │ A
|
||||
1 │ B
|
||||
━━━┷━━━━━━━━━
|
||||
> [1 2 2] | uniq -d
|
||||
```
|
||||
|
||||
### Counting
|
||||
|
||||
`--count` or `-c` is the flag to output a `count` column.
|
||||
|
||||
Only print unique lines lines
|
||||
```shell
|
||||
> `open test.csv | get type | uniq -c`
|
||||
───┬───────┬───────
|
||||
# │ value │ count
|
||||
───┼───────┼───────
|
||||
0 │ A │ 3
|
||||
1 │ B │ 2
|
||||
───┴───────┴───────
|
||||
> [1 2 2] | uniq -u
|
||||
```
|
||||
|
||||
Ignore differences in case when comparing
|
||||
```shell
|
||||
> ['hello' 'goodbye' 'Hello'] | uniq -i
|
||||
```
|
||||
|
||||
Remove duplicate rows and show counts of a list/table
|
||||
```shell
|
||||
> [1 2 2] | uniq -c
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user