Hi Admin,
This isn't a home work.
I am dealing with a flat file on RedHat Linux Server, which has millions of records (rows) and about 65 columns. Out of which only 3 columns needs this correction as below:-
From:-
"1912108",20161130,"2016-12-01-00.00.00.000000","2016-12-01-08.37.12.000000"
"1912108",20161201,"2016-12-02-00.00.00.000000","2016-12-02-08.28.22.000000"
To:-
"1912108",2016-11-30,"2016-12-01 00.00.00.000000","2016-12-01 08.37.12.000000"
"1912108",2016-12-01,"2016-12-02 00.00.00.000000","2016-12-02 08.28.22.000000"
I tried to format this as below, which works fine with the files that has few columns:-
awk -F "," '{print $1"|"substr($2,1,4)"-"substr($2,5,2)"-"substr($2,7,2)"|"substr($3,1,11)" "substr($3,13,26)"|"substr($4,1,11)" "substr($4,13,26)}' filename
Seeking help from this forum for a better solution, to deal with the file that has many columns in which case it is not a good idea to include all the columns under AWK print statement.
Thanks.