Separate the data according to the value of the field(s) specified in k=. Partitioned data is automatically stored in numbered file name sequence. A table is created with the list of keys specified at k= and the corresponding file name for each key.
msep2 k= O= a= [-p] [i=] [o=] [-nfn] [-nfno] [-x] [-q] [--help] [--version]
k= List of field name(s) as unit of division. O= Create list of sequentially numbered file (serial number starting from 0) in the specified directory. o= Correspondence table with sequentially numbered file names and values specified as key at k= is output as CSV file. Output is printed to standard output if this parameter is not specified. a= Field name of the path of output specified at o=. -p Force create directory specified by pathname at O=.
Split the data by corresponding values in item field. Output file names are sequential numbers starting from 0. The key and corresponding number is printed to table.csv.
$ more dat1.csv item,no A,1 A,1 A,2 B,1 B,2 $ msep2 k=item O=./output a=fileName o=table.csv i=dat1.csv #END# kgsep2 O=./output a=fileName i=dat1.csv k=item o=table.csv $ ls ./output 0 1 $ more table.csv item%0,fileName A,./output/0 B,./output/1 $ more output/0 item%0,no A,1 A,1 A,2 $ more output/1 item%0,no B,1 B,2
Each file name is created according to the sequential number using item,no as the composite key field. The key field and its corresponding sequential file names are printed to table.csv.
$ more dat1.csv item,no A,1 A,1 A,2 B,1 B,2 $ msep2 k=item,no O=./output2 a=fileName o=table.csv i=dat1.csv #END# kgsep2 O=./output2 a=fileName i=dat1.csv k=item,no o=table.csv $ ls ./output2 0 1 2 3 $ more table.csv item%0,no%1,fileName A,1,./output2/0 A,2,./output2/1 B,1,./output2/2 B,2,./output2/3 $ more output/0 item%0,no A,1 A,1 A,2
msep : Use this command to include the field header name in file name.