Forrest logo
back to the mlr tool

mlr:tldr:70dec

mlr: Sort in descending numerical order on a field.
$ mlr --icsv --opprint sort -nr ${field} ${example-csv}
try on your machine

This is a command that uses the "mlr" (Miller) tool to process a CSV file.

  • "mlr": This is the command-line tool name.
  • "--icsv": This flag indicates that the input file is in CSV format.
  • "--opprint": This flag specifies that the output should be formatted for improved human readability.
  • "sort -nr": This is a subcommand that sorts the input data in descending order (-nr) based on a specified field.
  • ${field}: This is a placeholder that should be replaced with the actual name of the field you want to use for sorting.
  • ${example-csv}: This is a placeholder that should be replaced with the path or name of the CSV file you want to process.

So, when you run this command, it will take a CSV file (${example-csv}), assume it is in CSV format (--icsv), sort it in descending order based on a specified field (${field}), and output the sorted data in a readable format (--opprint).

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mlr tool