(Video materials in preparation)
tagcjoin2 : Joins together tag data that exists in the tag master.
Records that do not exist are padded.
Usage : tagcjoin2 key=<tag> <master> <tran>
Options : +<string>
-e
-s<c>
Version : Tue Jan 9 09:02:34 JST 2024
Edition : 1
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.
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
1. <master> must be sorted on the key field, excluding the first
record (tag record). <tran> doesn't need to be sorted.
2. <master> must have unique values in all key fields.
3. The key field of <master> is the first field, and must be in the
same order as the key field of <tran>.
$ 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 0005 82 79 16
001 0004 58 71 20
001 0003 30 50 71
$ tagcjoin2 key=CODE master tran
SEQ CODE NAME AGE SEX A1 A2 A3
001 0005 George 042 WOM 82 79 16
001 0004 **** *** *** 58 71 20
001 0003 Wilson 026 WOM 30 50 71
$ tagcjoin2 +@ key=CODE master tran
SEQ CODE NAME AGE SEX A1 A2 A3
001 0005 George 042 WOM 82 79 16
001 0004 @ @ @ 58 71 20
001 0003 Wilson 026 WOM 30 50 71
$ cat tran | tagcjoin2 key=CODE master
$ cat tran | tagcjoin2 key=CODE master -
$ cat master | tagcjoin2 key=CODE - tag-tran