(Video materials in preparation)
name-tag : Converts a file in name format to tag format
Usage : name-tag <file>
Option : -d<c> Replaces space data
: -i<string> Replaces null data
: -c<tag> Outputs a counter
Version : Wed Apr 6 14:16:52 JST 2022
Edition : 1
name-tag converts a file in name format to tag format.
Single line of data.
$ cat name-data
A 1
B 2
C 3
$ name-tag name-data
A B C
1 2 3
Uses -d option to replace space data.
By default, spaces are converted to "_".
You cannot specify a replacement string that contains spaces.
$ cat name-data
AAA 1 1
BBB 2 2
CCC 3 3
$ name-tag -d_ name-data
AAA BBB CCC
1_1 2_2 3_3
Uses -i option to replace null data.
By default, null data is replaced with "_".
You cannot specify a replacement string that contains spaces.
$ cat name-data
A 1
B
C 3
$ name-tag -i@ name-data
A B C
1 @ 3
Multiple Data Lines
If the tag is in the format <Tag Name>_<Fixed-Width Number>,
all tags with the same number are combined into a single record.
In this case, tags are ordered in ASCII order. Records are
output in order of the fixed-width number.
$ cat name-data
A_001 1
B_001 2
C_001 3
A_002 4
B_002 5
C_002 6
A_003 7
B_003 8
C_003 9
$ name-tag name-data
A B C
1 2 3
4 5 6
7 8 9
Single line data and multi-line data combination
$ cat name-data
KEY 100
CODE 1234
A_001 1
B_001 2
C_001 3
A_002 4
B_002 5
C_002 6
A_003 7
B_003 8
C_003 9
$ name-tag name-data
KEY CODE A B C
100 1234 1 2 3
100 1234 4 5 6
100 1234 7 8 9
The -c option adds line numbers.
$ name-tag -c X name-data | fcols
KEY CODE X A B C
100 1234 001 1 2 3
100 1234 002 4 5 6
100 1234 003 7 8 9
1.When processing multiple lines, missing values are replaced with
the value specified in the -i option (default is "_").
2.name-tag is a shell script.