sort
container direction sortTypeby
expression
Direction is ascending
or descending
. The default is ascending
. SortType is text
, numeric
, dateTime
, or international
. The default is text
. Expression is any expression.
sort lines of steve by last word of each
sort items of bill descending numeric by word 2 of each
sort lines of steve ascending
sort items of bill dateTime
sort andy
sort it numeric
The sort
command will sort chunks of a string
, elements of a list
, bytes of a binary
, or child objects of an object that supports sorting.
The ascending
direction sorts in normal, ascending order, while the descending
direction sorts in reverse, descending order.
The text
sort type sorts by the Unicode code points of the characters in a string. The international
sort type sorts using the current locale's collation rules. The numeric
sort type sorts strings that look like numbers as numbers rather than strings. The dateTime
sort type sorts strings that look like dates as dates rather than strings.
The by
keyword sorts based on the values of the expression. The item being sorted is represented by the variable each
.