Specify the field to rename at f=, and the new column name at n=. Add the -q option to revert to the field header names as appeared in Ver. 1, and removes the sort order symbols appended to field names in output for 2.0 commands.
mfldname f=|n= [-nfni] [i=] [o=] [-nfno] [-x] [-q] [--help] [--version]
f= Specify the field name to change (current field name:new field name). The original field name will not change if this parameter is not set. n= Specify the new target column name. The number of item names must be the same as the number of columns in the data. -nfni Field name not present in input data. This option cannot be used with f=.
Change column name from “customer” to “cust”, and “october” to “oct”.
$ more dat1.csv customer,itemID,october a,xx,11 b,yy,122 c,zz, $ mfldname f=customer:cust,october:oct. i=dat1.csv o=rsl1.csv #END# kgfldname f=customer:cust,october:oct. i=dat1.csv o=rsl1.csv $ more rsl1.csv cust,itemID,oct. a,xx,11 b,yy,122 c,zz,
Change field names to x,y,z.
$ mfldname n=x,y,z i=dat1.csv o=rsl2.csv #END# kgfldname i=dat1.csv n=x,y,z o=rsl2.csv $ more rsl2.csv x,y,z a,xx,11 b,yy,122 c,zz,
$ more dat2.csv a,xx,11 b,yy,122 c,zz, $ mfldname -nfni n=x,y,z i=dat2.csv o=rsl3.csv #END# kgfldname -nfni i=dat2.csv n=x,y,z o=rsl3.csv $ more rsl3.csv x,y,z a,xx,11 b,yy,122 c,zz,
$ more dat3.csv customer%r,itemID,october c,zz, b,yy,122 a,xx,11 $ mfldname -q i=dat3.csv o=rsl4.csv #END# kgfldname -q i=dat3.csv o=rsl4.csv $ more rsl4.csv customer,itemID,october c,zz, b,yy,122 a,xx,11
mcut : Performs similar function to mfldname, however, the operation is more complicated to rename certain items. Nevertheless, the operation is slightly faster using mfldname.