Updated unique docs

This commit is contained in:
Mike Farah
2022-04-29 12:16:57 +10:00
parent 1425d0720e
commit 689c535a29
4 changed files with 17 additions and 13 deletions
+2 -1
View File
@@ -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.
+4 -2
View File
@@ -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
```