mlr --csv sort -f dept -nr salary data.csv

Category: Data Science & Analysis

mlr --csv sort -f dept -nr salary data.csv

Sort by dept ascending, then salary numeric descending

Sorts on two keys in priority order: dept first (ascending, text), then salary within each department (numeric descending). The sort verb applies -f and -nr flags as a key list, so this ranks the highest-paid people first inside every department. Multi-key sorting is the standard way to prepare ranked reports. Add more -f or -nr flags to extend the key chain.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.