3.40 mpadding - Row Padding

Fill in values in between the records specified at f= parameter based on the key field specified at k= parameter. When v= parameter is specified, create padding records in between records with the specified string other than the fields specified at k=,f=. Create padding with null values when -n option is specified. (Note: previous item value will be used as padding if both v= and -n parameters are not specified)

Format

mpadding [k=] f= [v=] [S=] [E=] [-n] [i=] [o=] [-nfn] [-nfno] [-x] [-q] [--help] [--version]

Parameter

k=

Specify the key field.

f=

Target field name for continuous padding.

 

Specify the field name to create padding as continuous values between records.

 

When creating padding in numerical values, attach %n as no%n.

 

Attach %d when creating padding for dates, or attach %t for padding for time.

 

Atttach %r when creating padding value in descending order as no%d%r.

v=

Specify padding value as character string.

 

Create padding with with the specified string other than the fields specified at k=,f=.

S=

Starting value

 

Specify the starting value of the series in f=.

E=

Ending value

 

Specify the ending value of the series in f=.

-n

Use null value as padding.

 

Return null values in fields other than those specified in k=, f=.

Examples

Example 1: Basic Example

Create padding with integer values (type=int) between records in no column. Insert 4,5 between 3 and 6, and 7 between 6 and 8.

$ more dat1.csv
no
3
6
8
$ mpadding f=no%n i=dat1.csv o=rsl1.csv
#END# kgpadding f=no%n i=dat1.csv o=rsl1.csv
$ more rsl1.csv
no%0n
3
4
5
6
7
8

Example 2: Specify the starting and ending value

Insert padding between records as well as before and after the first and last records from the input data. Specify the starting and ending range at S=,E=.

$ mpadding f=no%n S=1 E=10 i=dat1.csv o=rsl2.csv
#END# kgpadding E=10 S=1 f=no%n i=dat1.csv o=rsl2.csv
$ more rsl2.csv
no%0n
1
2
3
4
5
6
7
8
9
10

Example 3: Padding with date

Create padding to fill in values between dates (type=date) in the date column. Create padding values in columns other than those specified at k=,f=.

$ more dat2.csv
date,dummy
20130929,a
20131002,b
20131004,c
$ mpadding f=date%d i=dat2.csv o=rsl3.csv
#END# kgpadding f=date%d i=dat2.csv o=rsl3.csv
$ more rsl3.csv
date%0,dummy
20130929,a
20130930,a
20131001,a
20131002,b
20131003,b
20131004,c

Example 4: Specify character string for padding

Specify the character string padding value at v=.

$ mpadding f=date%d v=padding i=dat2.csv o=rsl4.csv
#END# kgpadding f=date%d i=dat2.csv o=rsl4.csv v=padding
$ more rsl4.csv
date%0,dummy
20130929,a
20130930,padding
20131001,padding
20131002,b
20131003,padding
20131004,c

Example 5: Specify NULL value as padding character

NULL value can be used as padding when the -n option is specified.

$ mpadding f=date%d -n i=dat2.csv o=rsl5.csv
#END# kgpadding -n f=date%d i=dat2.csv o=rsl5.csv
$ more rsl5.csv
date%0,dummy
20130929,a
20130930,
20131001,
20131002,b
20131003,
20131004,c

Related Command