uniq

Array

Removes consecutive duplicate values from an array. Like the Unix uniq command: only adjacent duplicates are removed. Sort the array first if you need all duplicates removed regardless of position.

Syntaxuniq

Use cases

Use caseDescriptionURL
Remove adjacent duplicatesStrip consecutive repeated values from a pre-sorted list.https://httpip.es/api/pipe/echo:[1,1,2,2,2,3,3,4]|uniq
Collapse repeated statusesReduce a run-length-encoded status log to a sequence of distinct states.https://httpip.es/api/pipe/echo:[{"s":"ok"},{"s":"ok"},{"s":"err"},{"s":"ok"}]|pluck:s|uniq
Dedupe sorted plucked fieldSort a field, then uniq to get sorted unique values efficiently.https://httpip.es/api/pipe/fetch:https://jsonplaceholder.typicode.com/todos|pluck:userId|sort|uniq

All commands