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

 

 

魂内検索

DOCUMENTS

COMMAND

FORUM

UEC DOCS

VIDEO

 

Alphabetical list

(Video materials in preparation)

tagcjoin2x(USP)

Name

tagcjoin2x : Joins together tag data that exists in the tag master.

             Records that do not exist are padded.

Synopsis

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

Options : +<string>

          -e

          -s<c>

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

Edition : 1

Description

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

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

records in tag format and outputs them to standard output.

The difference between this command and tagcjoin2 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.

For records that do not match, padding data "_" is joined for the

amount of fields in master. It is also possible to specify different

padding data by +<string> option.

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> must be sorted on the key field, excluding the first

   record (tag record).

Example 1

$ cat master

CODE NAME AGE SEX

0003 SMITH 026 WOM

0005 JONES 050 MAN

0005 JONES 048 WOM

0007 BROWN 042 WOM

$ cat tran

SEQ CODE A1 A2 A3

001 0005 82 79 16

001 0004 58 71 20

001 0003 30 50 71

$ tagcjoin2x key=CODE master tran

SEQ CODE NAME AGE SEX A1 A2 A3

001 0005 JONES 050 MAN 82 79 16

001 0005 JONES 048 WOM 82 79 16

001 0004 _ _ _ 58 71 20

001 0003 SMITH 026 WOM 30 50 71

Example 2 +<string> Options

$ tagcjoin2x +@ key=CODE master tran

SEQ CODE NAME AGE SEX A1 A2 A3

001 0005 JONES 050 MAN 82 79 16

001 0005 JONES 048 WOM 82 79 16

001 0004 @ @ @ 58 71 20

001 0003 SMITH 026 WOM 30 50 71

Example 3 Read from stdin

$ cat master | tagcjoin2x key=CODE - tran

$ cat tran | tagcjoin2x key=CODE master -

$ cat tran | tagcjoin2x key=CODE master      # "-" can be omitted

Note 1

+<string> option is the same as the deprecated -d<string> option

-d<string> options is scheduled to be removed