Hi,
My input file contains the record(s) as below with space as FS.
01-01024180 35000 MV010 02/03/09 0306 03060226 03
02-00410330 470000 MV010 02/03/09 0301 03010276 03
1. I need to convert the field 02/03/09 (dd/mm/yy) to yyyymmdd yet retain the Field separator.
Using the modified code below(
previous solution by Vgersh99 to Debian):
BEGIN {
FS=OFS=" "
PAT_percent="%"
# 'LENGTH of the fields'
split("-15 17 5 8 5 15 2", arrL, " ")
# 'TYPE of the fields"
split("s d s d s d s", arrT, " ")
}
{
for(i=1; i <= NF; i++) {
format=sprintf("%c%c%d%s%s", PAT_percent, (arrT[i] == "s") ? "-" : "0", arrL
[i], arrT[i], (i<NF) ? OFS : "\n")
printf(format, $i)
}
}
I get the output as:
01-01024180 00000000000035000 MV010 00000002 0306 000000003060226 03
02-00410330 00000000000470000 MV010 00000002 0301 000000003010276 03
Yet my intention is to get an output like:
01-01024180000000000000000035000MV010200903020030600000000306022603
02-00410330000000000000000470000MV010200903020030100000000301027603
Each record appearing as one single continuous line without field separators.
Would someone kindly guide.
Much Regards!
Pawee.