Lsort Command [LS]

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.

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}  

Lsort Command [LS]