(Video materials in preparation)
taglink2 : Joins together tag data that exists in the tag master.
Records that do not match are joined with dummy data.
Usage : taglink2 [+<string>] <mast_key>=<tran_key>... <master> <tran>
Version : Fri May 12 13:53:17 JST 2017
Edition : 1
Matches the field specified with <mast_key> in tag-formatted file <master>
with the field specified with <tran_key> in tag-formatted file <tran>,
joins the matching rows in tag format and outputs them to standard output.
You can specify multiple paris of <mast_key>=<tran_key>
Rows that do not match will be joined with the underscore character ("_")
in place of the fields in <master>. Use the +<string> option to replace
this underscore with a string of your choice.
If <master> is specified as "-" then the command reads from standard
input. If <tran> is omitted or specified as "-" then the command reads
from standard input.
If either <master> or <tran> are zero byte files, an error occurs.
Even if <master> and/or <tran> are null files (contain only a tag header),
the command processes normally.
1. Both <master> and <tran> must be sorted on the key field (excluding
the tag header).
2. <master> must have unique values in the key fields.
$ keta master
M.CODE M.NAME M.AGE M.SEX
0003 SMITH 026 WOM
0005 JONES 050 MAN
0007 WILSON 042 WOM
$ keta tran
T.SEQ T.CODE T.A1 T.A2 T.A3
001 0003 30 50 71
001 0004 58 71 20
001 0005 82 79 16
$ taglink2 M.CODE=T.CODE master tran | keta
M.CODE M.NAME M.AGE M.SEX T.SEQ T.CODE T.A1 T.A2 T.A3
0003 SMITH 026 WOM 001 0003 30 50 71
_ _ _ _ 001 0004 58 71 20
0005 JONES 050 MAN 001 0005 82 79 16
$ taglink2 +@@ M.CODE=T.CODE master tran | keta
M.CODE M.NAME M.AGE M.SEX T.SEQ T.CODE T.A1 T.A2 T.A3
0003 SMITH 026 WOM 001 0003 30 50 71
@@ @@ @@ @@ 001 0004 58 71 20
0005 JONES 050 MAN 001 0005 82 79 16
$ cat tran | taglink2 M.CODE=T.CODE master
$ cat tran | taglink2 M.CODE=T.CODE master -
$ cat master | taglink2 M.CODE=T.CODE - tran