mlr --csv sort -f age data.csv

Category: Data Science & Analysis

mlr --csv sort -f age data.csv

Sort CSV rows by the age column, lexicographically

The sort verb orders records by the fields given to -f, here age, in ascending order. Text fields sort lexicographically, so ages like 100 sort before 20; use -nr for numeric ordering instead. Multiple sort keys can follow -f, applied left to right. This is Miller's replacement for the sort command when headers must be preserved.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.