sort command

Use the sort command to sort text elements in the current document.

Syntax

sort [ all
     | { block | selection }
     | elementRange startElement [ endElement ]
     ]
     [ descending ]
     [ numeric ]
     [ localeSensitive ]
     [ columnRange startColumn [ endColumn ] ]
     [ newField
       [ descending ]
       [ numeric ]
       [ localeSensitive ]
       [ columnRange startColumn [ endColumn ] ]
     ] [...] 

Parameters

all Use the all parameter to sort all of the visible elements.
block | selection Use the block or selection parameter to sort only those elements included in the block selection.
elementRange
startElementendElement ]
Use the elementRange parameter to indicate the range of elements that you want to sort.  The startElement and endElement parameters must be positive integers indicating the ordinal positions of text elements in the document.  If you do not specify endElement, the element range will extend from startElement to the end of the document.
descending Use the descending parameter to indicate that the elements should be sorted in descending order.
numeric Use the numeric parameter to indicate that the element text should be interpreted as numbers rather than as text.
localeSensitive Use the localeSensitive parameter to indicate that the element text should be sorted based on locale-sensitive comparisons.
columnRange
startColumnendColumn ]
Use the columnRange parameter to indicate the column range of text that should be used in sort comparisons.  The startColumn and endColumn parameters must be positive integers indicating the column positions.  If you do not specify endColumn, the column range will extend to the end of the element.
newField Use the newField parameter to indicate that an additional field should be used to further sort the document.

Status

The status parameter is not affected by this command.

Description

If there is a block selection and you do not specify all or elementRange, the sort command will sort the elements that are included in the current block selection.

If there is no block selection and you do not specify elementRange, all of the visible elements in the document will be included in the sort.

If there is a rectangular block selection and you do not specify all, elementRange, or columnRange, the sort will be based on the text that is included in the rectangular block selection.

The sort command only affects visible elements that are not show elements.

Examples

sort
sort selection
sort elementRange 10 20 columnRange 1 4 newField columnRange 10 20 numeric descending 

Related concepts
Editor commands, actions, and parameters

Related reference
show parameter
visible parameter