uspTukubaiコマンドに関する様々な資料がここにあります。

 

 

魂内検索

DOCUMENTS

COMMAND

FORUM

UEC DOCS

VIDEO

 

Alphabetical list

(Video materials in preparation)

tagmax(USP)

Name

tagmax : Calculates the maximum value of records with the same key value

Synopsis

Usage   : tagmax <k1> <k2> [<v1> <v2>] <file>

          tagmax [key=<key>] [val=<val>] <file>

Version : Tue Jan  9 09:02:34 JST 2024

Edition : 1

Description

Calculates the maximum value of the specified field of all records

that have the same value in the specified key field.  You can

specify the key field two ways, as starting key <k1> to ending key

<k2> (conventional notation) or <key> (keyword notation).

In conventional notation, the relationship of the fields must follow

this rule: <k1> <= <k2> < <v1> <= <v2>.  In keyword notation, <key>

designates the field position as fllows:

single field       TAGa       TAGa field

contiguous fields  TAGa/TAGb from TAGa field to TAGb field

combination        TAGa@TAGb  TAGa field and TAGb field

There is no limit on the length of the key field or on the number

of key fields.  The key field can also contain multi-byte characters

such as Japanese.

The tag name specfying the field can be eclosed by braces {}.  In

this case, tag names can include special charcter like "/" or "@".

Moreover, tag names can include pairs of braces.

If you specify the fields as <v1> <v2> then the maximum value is

calculated for all fields from <v1> to <v2>.  If you specify it

as val=<val> then use formats shown above for key=<key>.  If you

omit the fields to be calculated maximum value then all fields

except for the key fields are calculated.

The maximum value will be output to a precision equal to the highest

precision value in each field.

Example 1

$ fcols data

K1            K2     N1     N2 N3 N4 N5

01    New_Jersey     91     59  20 76 54

01    New_Jersey     46     39      8  5 21

01    New_Jersey     82      0     23  84 10

02      New_York   30.3   50.6 71.2 36.32 30.0

02      New_York   78.5     13     44   28 51.05

02      New_York     58 71.128 20.333    10     6

02      New_York   39.1  22.61  13.45 76.11     8

02      New_York   82.3   79.0 16.22 21.22 80.3

02      New_York  50.55   2.12  33.4 15.6    62

03   Connecticut     52     91   44 9 0

03   Connecticut     60     89   33 18 6

03   Connecticut     95     60   35 93 76

04 Massachusetts  92.44 56.63 83.123 96.71    75

04 Massachusetts 30.555 12.328  32.31 44.79 19.1

04 Massachusetts  48.24 66.93   23.1 71.5 24.11

04 Massachusetts   45.1   21.9 24.26 39.82 3.22

Calculate the maximum for N1 - N5 for each state.

$ tagmax K1 K2 data | fcols

K1            K2     N1     N2 N3 N4 N5

01    New_Jersey     91     59  23 84 54

02      New_York  82.30 79.000 71.200 76.11 80.30

03   Connecticut     95     91   44 93 76

04 Massachusetts 92.440 66.930 83.123 96.71 75.00

key=<key> syntax

$ tagmax key=K1/K2 data | fcols

K1            K2     N1     N2 N3 N4 N5

01    New_Jersey     91     59  23 84 54

02      New_York  82.30 79.000 71.200 76.11 80.30

03   Connecticut     95     91   44 93 76

04 Massachusetts 92.440 66.930 83.123 96.71 75.00