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

 

 

魂内検索

DOCUMENTS

COMMAND

FORUM

UEC DOCS

VIDEO

 

Alphabetical list

(Video materials in preparation)

tagloopj(USP)

Name

tagloopj : loopj command for tag files

Synopsis

Usage   : tagloopj key=<key> <file1> <file2> ...

Options : -d<string>

          -e

          -s<c>

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

Edition : 1

Description

The specified tag files <tagfile1> <tagfile2> ... are processed

with loopj. The output is also tag formatted.

If <file> is specified as "-" then the command reads from STDIN.

The -d option allows you to change the default dummy character ("0").

You may specify <key> 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

If <file> is a zero byte file, an error is generated.

If <file> is a null file (contains only a tag line) the command

processes normally.

Example 1

$ cat tagfile1

CODE NAME ADDRESS

0001 nobu sinjuku

0003 toppo sibuya

$ cat tagfile2

CODE DATE1 DATE2

0002 0503 0504

$ cat tagfile3

CODE DOLL1 DOLL2

0001 100 200

0002 200 300

$ tagloopj key=CODE tagfile1 tagfile2 tagfile3 | fcols

$ cat tagfile2 | tagloopj key=CODE tagfile1 - tagfile3 | fcols

CODE  NAME ADDRESS DATE1 DATE2 DOLL1 DOLL2

0001  nobu sinjuku     0     0   100 200

0002     0       0  0503 0504   200 300

0003 toppo  sibuya     0     0    0 0

Example 2

$ tagloopj -d@ key=CODE tagfile1 tagfile2 tagfile3 | fcols

CODE  NAME ADDRESS DATE1 DATE2 DOLL1 DOLL2

0001  nobu sinjuku     @     @   100 200

0002     @       @  0503 0504   200 300

0003 toppo  sibuya     @     @    @ @

Example 3

If <tagfile> has only tags and no data, then dummy data

is joined.

$ cat tagfile4

CODE DUMY1 DUMY2

$ tagloopj key=CODE tagfile1 tagfile2 tagfile4 | fcols

CODE  NAME ADDRESS DATE1 DATE2 DUMY1 DUMY2

0001  nobu sinjuku     0     0    0 0

0002     0       0  0503 0504     0    0

0003 toppo  sibuya     0     0    0 0

Example 4

You can specify multiple fields as the key. In this case, the key field

position in each file does not need to be the same.

$ cat tagfile1

CODE NAME CODE2 ADDRESS

0001 nobu A sinjuku

0001 nobu B sibuya

0002 toppo A sinjuku

0002 toppo B sibuya

$ cat tagfile2

CODE DATE1 DATE2 CODE2

0001 0503 0504 A

0002 0607 0608 A

$ cat tagfile3

CODE DOLL1 DOLL2 CODE2

0001 100 200 B

0002 200 300 A

$ tagloopj key=CODE@CODE2 tagfile1 tagfile2 tagfile3 | fcols

CODE CODE2  NAME ADDRESS DATE1 DATE2 DOLL1 DOLL2

0001     A  nobu sinjuku 0503 0504     0    0

0001     B  nobu  sibuya     0    0 100 200

0002     A toppo sinjuku  0607 0608   200 300

0002     B toppo  sibuya     0    0 0 0