mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 14:14:52 +08:00
Updated unique docs
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# Unique
|
||||
|
||||
This is used to filter out duplicated items in an array.
|
||||
This is used to filter out duplicated items in an array. Note that the original order of the array is maintained.
|
||||
|
||||
|
||||
@@ -9,10 +9,12 @@ Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#
|
||||
{% endhint %}
|
||||
|
||||
## Unique array of scalars (string/numbers)
|
||||
Note that unique maintains the original order of the array.
|
||||
|
||||
Given a sample.yml file of:
|
||||
```yaml
|
||||
- 1
|
||||
- 2
|
||||
- 1
|
||||
- 3
|
||||
- 2
|
||||
```
|
||||
@@ -22,8 +24,8 @@ yq 'unique' sample.yml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
- 1
|
||||
- 2
|
||||
- 1
|
||||
- 3
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user