mlr --csv uniq -g dept data.csv

Category: Data Science & Analysis

mlr --csv uniq -g dept data.csv

Keep one row per unique dept value

With -g dept, uniq keeps the first record for each distinct value of the dept field, like SELECT DISTINCT on one column. This answers questions such as which departments appear in the data and where each first occurs. Whole-row dedup uses -a instead. The output row count equals the number of unique departments.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.