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

 

 

魂内検索

DOCUMENTS

COMMAND

FORUM

UEC DOCS

VIDEO

 

Alphabetical list

(Video materials in preparation)

tagjoin0(USP)

Name

tagjoin0 : Outputs tag data whose tags exist in the Tag Master

           Records that don't exist are discarded.

Synopsis

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

Options : +ng[<fd>]

          -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> and outputs the

matching records in tag format to standard output.

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. <master> must have unique values in all key fields.

3. 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 Wilson 026 WOM

0005 Parker 050 MAN

0007 George 042 WOM

$ cat tran

SEQ CODE A1 A2 A3

001 0003 30 50 71

001 0004 58 71 20

001 0005 82 79 16

$ tagjoin0 key=CODE master tran

SEQ CODE A1 A2 A3

001 0003 30 50 71

001 0005 82 79 16

Example 2 +<ng> option

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

$ cat ok

SEQ CODE A1 A2 A3

001 0003 30 50 71

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

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

Example 3 Read from standard input

$ cat tran   | tagjoin0 key=CODE master

$ cat tran   | tagjoin0 key=CODE master -

$ cat master | tagjoin0 key=CODE - tran