Lsort Command [LSO]

Qedit 5.7 for HP-UX

Home Previous Next


Lsort Command [LSO]

Sorts a range of lines.

LSORT range [ KEYS keylist ]

LSORT string range [ KEYS keylist ]

(Q=no display)

(Default: by entire line)

The simplest Lsort command just specifies a range of lines to be sorted and no other parameters. This means to use the entire line as the key and sort the lines into ascending order, printing them once sorted.

To stop Lsort from printing the sorted lines, use LsortQ. The Lsort command can be abbreviated to "lso", "lsq" (quiet), "lst" (template) and "lsj" (justify). "ls" followed by a space executes the HP-UX shell command. "ls" followed by any other character is executed as a possible shell command.

Parameters

To sort by some other key fields in the lines (from one to four are supported) or to sort the lines in Descending Order, you need to specify the KEYS keylist parameters. The keylist consists of one to four keys separated by spaces or commas, with a key consisting of either a column range or a starting column and length:

column , length [DESC]

column / column [DESC]

Ascending Order is assumed by default, but you may specify DESC to sort this key in Descending Order.

Examples

/lsort all           {sort entire file}
/lsortq all          {sort without printing}
/lsort 10/33         {sort some lines only}
/lsort 30/last keys 10,5            {col 10 through 14}
/lsort zz keys 10/20                {col 10 through 20}
/lsort 20/last keys 1,10 20,5,desc  {two keys}


Home Previous Next