Replace NULL values in the field(s) specified at f= parameter with a character string defined at v= parameter.
mnullto f= [v=|-p] [O=] [-A] [i=] [o=] [-nfn] [-nfno] [-x] [--help] [--version]
f= Replace null values in the field(s) (multiple fields can be specified). v= Replace null values with this string. -p Replace null values in the previous row. This option cannot be specified with v= parameter. O= String to replace non-null values. When this parameter is not specified, non-null values will not be replaced. -A Add replacement string as new column. When -A option is specified, define the new field name using a colon (:) after the field name. Example: f=quantity:ReplacementFieldName.
Replace NULL values in the ¥verb|birthday| field with the string “no value”.
$ more dat1.csv customer,birthday A,19690103 B, C,19500501 D, E, $ mnullto f=birthday v="no value" i=dat1.csv o=rsl1.csv #END# kgnullto f=birthday i=dat1.csv o=rsl1.csv v=no value $ more rsl1.csv customer,birthday A,19690103 B,no value C,19500501 D,no value E,no value
Replace Null values in the birthday field with the string "no value" and change non-null values to the string ¥verb|"value"|, and rename the output column as entry.
$ mnullto f=birthday:entry v="no value" O="value" i=dat1.csv o=rsl2.csv #END# kgnullto O=value f=birthday:entry i=dat1.csv o=rsl2.csv v=no value $ more rsl2.csv customer,entry A,value B,no value C,value D,no value E,no value
Replace Null values in the birthday field with the string "no value" and change non-null values to the string "value". Output the replacement strings in a new column named entry.
$ mnullto f=birthday:entry v="no value" O="value" -A i=dat1.csv o=rsl3.csv #END# kgnullto -A O=value f=birthday:entry i=dat1.csv o=rsl3.csv v=no value $ more rsl3.csv customer,birthday,entry A,19690103,value B,,no value C,19500501,value D,,no value E,,no value
$ more dat2.csv id,date A,19690103 B, C,19500501 D, E, $ mnullto f=date -p i=dat2.csv o=rsl4.csv #END# kgnullto -p f=date i=dat2.csv o=rsl4.csv $ more rsl4.csv id,date A,19690103 B,19690103 C,19500501 D,19500501 E,19500501
mdelnull : Remove rows containing NULL values.
mchgstr : Replace NULL value with character strings.