sort-by
Sort by the given columns, in increasing order.
Signature
> sort-by ...columns --reverse --insensitive --natural
Parameters
...columns
: the column(s) to sort by--reverse
: Sort in reverse order--insensitive
: Sort string-based columns case-insensitively--natural
: Sort alphanumeric string-based columns naturally
Examples
sort the list by increasing value
> [2 0 1] | sort-by
sort the list by decreasing value
> [2 0 1] | sort-by -r
sort a list of strings
> [betty amy sarah] | sort-by
sort a list of strings in reverse
> [betty amy sarah] | sort-by -r
sort a list of alphanumeric strings naturally
> [test1 test11 test2] | sort-by -n
Sort strings (case-insensitive)
> echo [airplane Truck Car] | sort-by -i
Sort strings (reversed case-insensitive)
> echo [airplane Truck Car] | sort-by -i -r
Sort a table by its column (reversed order)
> [[fruit count]; [apple 9] [pear 3] [orange 7]] | sort-by fruit -r