Count the number of rows and store the results in a new column defined in a= parameter. Counting is carried out by each aggregate key when k= parameter is specified. Otherwise, if k= is not specified, all rows are counted.
mcount a= [k=] [i=] [o=] [-nfn] [-nfno] [-x] [-q] [--help] [--version]
a= Specify the new field name to be added. This parameter is not required when nfn option is specified. k= Key item(s) (Multiple keys can be specified) [aggregate key break processing] Count the number of instances for incremental rows based on the key field(s) defined.
Count the number of rows by date, and save the results in a new column count.
$ more dat1.csv date 20090109 20090109 20090109 20090110 20090110 $ mcount k=date a=count i=dat1.csv o=rsl1.csv #END# kgcount a=count i=dat1.csv k=date o=rsl1.csv $ more rsl1.csv date%0,count 20090109,3 20090110,2
Count the number of rows without specifying the aggregate key.
$ mcount a=count i=dat1.csv o=rsl2.csv #END# kgcount a=count i=dat1.csv o=rsl2.csv $ more rsl2.csv date,count 20090110,5
mstats : Specify c=count to count non-null values in the data.