sort

Sort in increasing order.

Signature

> sort --reverse --insensitive --values

Parameters

  • --reverse: Sort in reverse order
  • --insensitive: Sort string-based columns case-insensitively
  • --values: If input is a single record, sort the record by values, ignored if input is not a single record

Examples

sort the list by increasing value

> [2 0 1] | sort

sort the list by decreasing value

> [2 0 1] | sort -r

sort a list of strings

> [betty amy sarah] | sort

sort a list of strings in reverse

> [betty amy sarah] | sort -r

Sort strings (case-insensitive)

> echo [airplane Truck Car] | sort -i

Sort strings (reversed case-insensitive)

> echo [airplane Truck Car] | sort -i -r

Sort record by key

> {b: 3, a: 4} | sort

Sort record by value

> {a: 4, b: 3} | sort