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

 

 

魂内検索

DOCUMENTS

COMMAND

FORUM

UEC DOCS

VIDEO

 

Alphabetical list

(Video materials in preparation)

cljoin1(USP)

Name

cljoin1 : The longest prefix key matching version of cjoin1.

Synopsis

Usage   : cljoin1 key=<n> <master> <tran>

Option  : +ng[<fd>]

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=<n> in <tran> and the first field in <master>,

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>

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

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

A New_York B

C New_Jersey_Trenton D

E Delaware F

$ cljoin1 +ng3 key=2 master trans > ok 3> ng

$ cat ok

A New_York New_York bar B

C New_Jersey_Trenton New_Jersey_Trenton foo2 D

$ cat ng

E Delaware F