3.70 mvdelnull - Remove a NULL Element in Vector

Remove all NULL elements in the vector. If NULL element exist in vector, there will be consecutive delimiters of the elements. All vectors shown below contains NULL elements. However, for ease of reading, `\n' is added at the end of each vector. Reading from the top row, the 3rd element, 1st element, 4th element are NULL.

a b  c\n
 a b\n
a b c \n

Format

mvdelnull vf= [-A] [delim=] i= [o=] [delim=] [-nfn] [-nfno] [-x] [--help] [--version]

vf=

Specify the field name (from input file i= ) which contains NULL element for removal.

 

Multiple files can be specified.

-A

Instead of replacing the specified item, this option

 

adds output as a new field.

 

When -A open is specified, the new field name must be specified after :(colon).

 

Example: f=quantity:substitution field name

Examples

Example 1: Basic example of removing null characters

$ more dat1.csv
items
b a  c
 c c
e a   b 
$ mvdelnull vf=items i=dat1.csv o=rsl1.csv
#END# kgvdelnull i=dat1.csv o=rsl1.csv vf=items
$ more rsl1.csv
items
b a c
c c
e a b

Example 2: Example of using .(dot) as delimiting character

$ more dat2.csv
items
b.a..c
.c.c
e.a...b.
$ mvdelnull vf=items delim=. i=dat2.csv o=rsl2.csv
#END# kgvdelnull delim=. i=dat2.csv o=rsl2.csv vf=items
$ more rsl2.csv
items
b.a.c
c.c
e.a.b

Example 3: Add output as an new field by specifying -A

$ mvdelnull vf=items:new -A i=dat1.csv o=rsl3.csv
#END# kgvdelnull -A i=dat1.csv o=rsl3.csv vf=items:new
$ more rsl3.csv
items,new
b a  c,b a c
 c c,c c
e a   b ,e a b

Related Command

mvnullto : Replace NULL element to any value.