Dsort - Sorting by key values

[ English | Japanese ]

[visit D-home]

SYNOPSIS

Dsort [ -k key-flags ] [ -T directory ] key-field-list [ input-file.. ]

DESCRIPTION

Dsort sorts a D-file with the given key-field-list. It is a list of:

field-name[:key-flags]

Key-flags here is a string of following characters (subset of flags of UNIX sort) which gives the key attributes of the field.

n
numeric; values are converted to numeric (double)
r
reverse order (descending order)
f
capital letters; small letters are converted to capital
d
dictionary order
i
non-print characters are eliminated

The first entry of the key-field-list becomes the first sort key, the second entry becomes the second key, and so on. When all key fields are equal, input sequence is kept (i.e., input record sequence in ascending order is assumed to be the last sort key).

OPTIONS

-k key-flags
default key-flags for the key-field-list. Note that this default value has effect only for the fields which have no key-flags in the list. See the manual of Dintro.
-T directory
temporary file directory. Dsort uses temporary files when the workspace (xmem size) is not enough for whole file sorting. If no -T option is given, in Windows environment, TEMP environment value is use, and no TEMP environment is given, c:\temp is used. In UNIX environment, TMPDIR environment value is used, and when no TMPDIR environment is given, /tmp is used. In the case specified directory is not writable, the same order is applied to allocate temporary file directory.
-D xmem=workspace
size of workspace memory by unit of KB (1024bytes). Default value is 32768 (32MB). It is not recommended to set this value greater than real memory size.
-D [i/o]datautf=8|16|32
UTF I/O feature (see manual page of UTF I/O feature.)

EXAMPLES

Sort by "count" field value (numeric) by descending order. This is often used after Dfreq command.

Dsort count:nr

Same result by

Dsort -k rn count

Sort by "word"(no case) and "page" (numeric).

Dsort word:f,page:n

ENVIRONMENT

TMPDIR
temporary file directory (UNIX). Default is /tmp.
TEMP
temporary file directory (Windows). Default is c:\temp.
Ddatautf, Didatautf, Dodatautf
for UTF I/O feature.

DIAGNOSTICS

See the manual of D_msg.

SEE ALSO

Dintro, D_msg.

AUTHOR

MIYAZAWA Akira


miyazawa@nii.ac.jp
2003