Sorts lines of text.
Scope: Document
Syntax
Parameters
Number |
Sort from the current line up to, but not including, line Number in the file |
+Number |
Sort the next Number lines, starting with the current line |
BLOCK |
Sort all lines in a block of selected text |
* |
Sort all lines from the current line to the end of the file, including the last line in the file |
Mmark |
Sort from the current line up to, but not including, the line containing the named mark mark. |
"string" |
Sort from the current line up to, but not including, the line containing the next occurence of the string expression specified in string. |
A |
Sort by ascending string value. This is the default if a sort ordering type is not specified. |
D |
Sort by descending string value |
AN |
Sort by ascending numeric value |
DN |
Sort by descending numeric value |
AI |
Sort by ascending string value, ignoring character case |
DI |
Sort by descending string value, ignoring character case |
col1 col2 |
A pair of column numbers defining a sort field within each line. Column numbers are always absolute column numbers. Up to 100 pairs of column numbers can be defined as part of a sort command line invocation, with highest sort priority given to the first column number pairs appearing in the command line invocation. If no column number pairs are specified, the entire line is considered to be the sort field. |
Description
The sort command provides a method of sorting information in specific areas of a file. Options associated with the sort command let you define sort fields for data in specific locations on each line, and apply the sort operation to specific sets of lines.
The BLOCK option of the sort command lets you restrict sort operations to only blocks of selected text, including rectangular blocks of text if the blockdefaulttype parameter is set to rectangle.
Examples
sort 25
sort +25 D
sort BLOCK AI 10 15
sort * AN 73 80
sort Mlimit A 10 15 5 6
sort "arbitrary" A
API Return Codes
-1 |
String or mark not found |
-2 |
Invalid parameter argument supplied |
-6 |
Bad block defined |
-8 |
Out of memory |
![]()
