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

 

 

魂内検索

DOCUMENTS

COMMAND

FORUM

UEC DOCS

VIDEO

 

Alphabetical list

(Video materials in preparation)

tagcljoin1(USP)

 

Name

tagcljoin1 : The longest prefix key matching version of tagcjoin1.

 

Synopsis

Usage   : tagcljoin1 key=<tag> <master> <tran>

Option  : +ng[<fd>]

          --tagname <tagname>

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

Edition : 1

 

Description

This command joins to a record in <tran> a record in <master> whose

key, specified by key=<tag>, is the longest one (in <master>) that

starts with the key of the record in <tran>, if such a record exists.

 

The matching is longest prefix match in the sense that those keys in

<tran> longer than a key of a field in <master> are to be truncated

as long as the length of the key of the field in <master> before

compared by exact matching.  When multiple matches are possible, the

record with the longest key is chosen.

 

Joined fields are arranged in the following order:

1. the fields in <tran> preceding the key field <tag>

2. the key field <tag> in <master>

3. the key field <tag> in <tran>

4. the fields in <master> succeeding <tag>

4. the fields in <tran> succeeding <tag>

 

The tag of key field of <tran> is "*".  --tagname option can be

change the tag.

 

Records in <master> should be sorted to ascending order by key field

and keys should beunique in <master>, that is, two different records

must have different keys.

In contrast, <tran> may be arbitrarily ordered and keys are not

required to be unique.

 

Unmatched records in <tran> will be discarded unless +ng option is

specified, which asks the command to redirect unmatched records to a

file descriptor <fd>.  If <fd> is omitted, unmatched records are

redirect to the standard error output.

 

If "-" is designated as <master>, the command reads <master> from

the standard input.  If "-" is designated as <tran> or omitted, the

command reads <tran> from the standard input.  Both of <master> and

<tran> are specified to read from the standard input, the execution

fails.

 

Example 1

(Master)

$ cat master

KEY M1

New_Jersey foo

New_Jersey_Trenton foo2

New_Jersey_Trenton_Downtown foo3

New_York bar

New_York_Manhattan bar2

New_York_Manhattan_Midtown bar3

 

(Transaction)

$ cat tran

T1 KEY T2

A New_York B

C New_Jersey_Trenton D

E Delaware F

 

$ tagcljoin1 +ng3 key=KEY master trans > ok 3> ng

$ cat ok

T1 KEY * M1 T2

A New_York New_York bar B

C New_Jersey_Trenton New_Jersey_Trenton foo2 D

$ cat ng

T1 KEY T2

E Delaware F

 

Example 2

Use --tagname option to specify the tag name of key field in <tran>.

$ tagcljoin1 --tagname=TRAN_KEY key=KEY master trans > ok

$ cat ok

T1 KEY TRAN_KEY M1 T2

A New_York New_York bar B

C New_Jersey_Trenton New_Jersey_Trenton foo2 D