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

 

 

魂内検索

DOCUMENTS

COMMAND

FORUM

UEC DOCS

VIDEO

 

Alphabetical list

(Video materials in preparation)

tagjoin1x(USP)

Name

tagjoin1x : Joins together tag data that exists in the tag master in

    all possible combinations.

            Records that do not exist are discarded.

Synopsis

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

Options : +ng[<fd>]

          -e

          -s<c>

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

Edition : 1

Description

Matches the key field as specified by key=<key> in tag-formatted

file <master> with tag-formateed file <tran>, joins the matching

records in tag format and outputs them to standard output.

The difference between this command and tagjoin1 is that more than

one record in <master> can have a key field with the same value.  If

more than one record with the same key field value exists, then the

records are joined in all possible combinations.

Non-matching records are discarded, however if you specify the +ng

option then these records are output in tag format to standard error.

If you specify "-" as <master> then it will be read from standard

input.  If you omit <tran> or specify "-" then it will be read from

standard input.

If either <master> or <tran> are empty files, an error occurs.  If

either <master> or <tran> are null files (only contain the tag

record) the command processes normally.

<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.

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.

  TAGa:n/TAGb:n     OK

  TAGa:n/TAGb:nr    Error

  TAGa:n/TAGb:r     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)

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.  When comparison

method is attached to brace enclosed tag name, ":" should be ommited.

    {TAGa}n/{TAGb}n

Restrictions

1. <master> and <tran> must be sorted on the key field, excluding

   the first record (tag record).

2. The key field of <tran> must be in the same order as the key

   field of <master>.

Example 1

$ cat master

CODE NAME AGE SEX

0003 Newton 026 WOM

0005 Watson 050 MAN

0005 Watson 048 WOM

0007 Nelson 042 WOM

$ cat tran

SEQ CODE A1 A2 A3

001 0003 30 50 71

001 0004 58 71 20

001 0005 82 79 16

$ tagjoin1x key=CODE master tran

SEQ CODE NAME AGE SEX A1 A2 A3

001 0003 Newton 026 WOM 30 50 71

001 0005 Watson 050 MAN 82 79 16

001 0005 Watson 048 WOM 82 79 16

Example 2 +ng option

$ tagjoin1x +ng key=CODE master tran >ok 2>ng

$ cat ok

SEQ CODE NAME AGE SEX A1 A2 A3

001 0003 Newton 026 WOM 30 50 71

001 0005 Watson 050 MAN 82 79 16

001 0005 Watson 048 WOM 82 79 16

$ cat ng

SEQ CODE A1 A2 A3

001 0004 58 71 20

In order not to be mixed with error messages, you can specify an

output other than standard error.  If there are many matching

records, using an output other than standard output is faster.

$ tagjoin1x +ng3 key=CODE master tran >ok 3>ng

Example 3 Read from standard input

$ cat tran   | tagjoin1x key=CODE master

$ cat tran   | tagjoin1x key=CODE master -

$ cat master | tagjoin1x key=CODE - tran