3.75 mvuniq - Unique Vector Elements

This command merges duplicate elements in a vector. However, since the merging process uses a tree structure, the sequence of elements in the output maybe not be in order.

When -n option is specified, the command reads the vector as a sequential series. The vector series is scanned from the beginning of the string, and output unique character strings in the vector.

The examples are highlighted in Table 3.46, 3.46. Table 3.46 shows all merged elements in the data series. When -n option is specified, same elements next to each other are merged in sequential order. In Table 3.46, consecutive elements of b are merged.

Table 3.46: Input data
in.csv

no

items

1

b a a

2

a a b b b

3

a b b a

4

a b c

: Caption text
Basic example vf=items i=in.csv

no

items

1

a b

2

a b

3

a b

4

a b c

: Caption text
Merge same elements adjacent to each other in a vector series vf=items -n i=in.csv

no

items

1

b a

2

a b

3

a b a

4

a b c

Format

mvuniq vf= [-n] [i=] [o=] [delim=] [-nfn] [-nfno] [-x] [--help] [--version]

vf=

Specify the target field name(s) of vectors.

 

Multiple field name(s) of vectors can be specified.

-n

Merges same elements adjacent to each other in the vector.

Example

Example 1: Merges vector elements in multiple fields

$ more dat1.csv
items1,items2
b a c,1 1
c c,2 2 3
e a a,3 1
$ mvuniq vf=items1,items2 i=dat1.csv o=rsl1.csv
#END# kgvuniq i=dat1.csv o=rsl1.csv vf=items1,items2
$ more rsl1.csv
items1,items2
a b c,1
c,2 3
a e,1 3

Related Command