Dmax - Selection of the maximum/minimum value records

[ English | Japanese ]

[visit D-home]

SYNOPSIS

Dmax [ -g group-by-key ] [ options ] key-field-list [ input-file.. ]

DESCRIPTION

Dmax selects record[s] of which key-field-list value is maximum within the whole input files. If there are more than one record having maximum key value, all the records are selected keeping input record sequence.

Note that Dmax may select all the records in the input files, when the records have same key value. In this case, you need memory to hold all the input records. Especially, this may happen when you give wrong field name.

You can select minimum key value records by giving r key flag or by giving -v option.

Key value evaluation follows the value comparison rule of D-commands. See Comparison of values section of Dintro.

OPTIONS

-F
adds "filename" field to each output record; maximum key value records are selected from each input file.
-g group-by-key-field-list
group by process; maximum key value records are selected each time when the group by key value is changed. Usually, you need to sort input file before group by process.
-k key-flags
default key-flags for both key-field-list and group-by-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.
-v
select the minimum value records instead of maximum value. Multiple occurence of -v toggles the effect.
-D [i/o]datautf=8|16|32
UTF I/O feature (see manual page of UTF I/O feature.)

EXAMPLES

Select count field (numeric) max record.

Dmax count:n

Select minimum record (count field: numeric).

Dmax -v count:n

For each id value, select the last date,time value records.

Dmax -g id date,time

FIXED NAME FIELDS

filename:
at the top of each record, when -F option is specified. Value is the input file name in the form of the command arguments after globbed by the shell. This field is not added when the input file is the standard input.

ENVIRONMENT

Ddatautf, Didatautf, Dodatautf
for UTF I/O feature.

DIAGNOSTICS

See the manual of D_msg.

SEE ALSO

Dintro, Dmeans, D_msg.

AUTHOR

MIYAZAWA Akira


miyazawa@nii.ac.jp
2006