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

 

 

魂内検索

DOCUMENTS

COMMAND

FORUM

UEC DOCS

VIDEO

 

Alphabetical list

(Video materials in preparation)

upl(USP)

Name

upl : Merges two files on the same key field and then extracts

      the final line of a group of lines that share the same key

      value.

Synopsis

Usage   : upl key=<key> <master> <tran>

Options : -e

          -s<c>

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

Edition : 3

Description

Selects all rows of file <tran> (or standard input) where the

key field specified as key=<key> matches the same key field in

<master>, then merges those rows below the row in <master>

and finally extracts the last record in the group of rows that share

the same key value.  Both <master> and <tran> must be sorted.

<key> designates the field position as fllows:

single field       2        the 2nd field

                   NF   the last field

                   NF-1   the field just before the last field

contiguous fields  2/4      from the 2nd field to the 4th field

                   4/2   from the 4th field to the 2nd field

                   NF-3/NF  from NF-3 field to the NF field

combination        2@NF     the 2nd field and the NF 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.

If you specify "r" as comparison method after the field position,

the fields are compared in reverse order.  If you specify "n" as

comparison method after the field position, that field's values will

be compared as numbers.  If you specify "nr" as comparison method

after the field, the values will be compared in reverse order as

numbers.  If you specify comparison method before or after the "/",

you must use the same comparison method for both fields.

  2n/5n     OK

  2n/5nr    Error

  2n/5r     Error

When you specify "e" as comparison method or specify -e ootion and no

method, characters in the field are replaced as follows and compared

as string:

  _  ==> 0x20 (space)

  \0 ==> 0x00 (null)

  \t ==> 0x09 (tab stop)

  \n ==> 0x0a (new line)

  \r ==> 0x0d (carrige return)

  \_ ==> 0x5f (underscore)

  \\ ==> 0x5c (back slash)

* Performs the same function as up3 + getlast.

Example 1

(Master:master)

aShop 103 62

bShop 157 94

cShop 62 30

dShop 210 113

eShop 237 121

(Transaction:tran)

aShop 131 84

cShop 198 105

eShop 81 48

$ upl key=1 master tran > data

(data)              <- Merges tran and outputs the last line for that shop

aShop 131 84

bShop 157 94

cShop 198 105

dShop 210 113

eShop 81 48