Can somebody please help me with the below conversion shell script ?
Source File File 1 : for example
EXCHANGE_ID : 192, 410,
EXCHANGE_DTTM : 2015-06-11+02:18:40+0000, 2015-06-11+02:12:28+0000,
PART_NAME : MRT, LR04,
PART_TRANS_ID : 123, JAS04,
M_NAME : FAILED, FAILED,
M_DTTM : 2015-06-11T02:18:40+0000 2015-06-11T02:12:28+0000
OutPut as :
EXCHANGE _ID : 192
EXCHANGE_ DTTM : 2015-06-11T02:18:40+0000
PART_NAME : MRT
PART_TRANS_ID : 123
M_NAME : FAILED
M _DTTM : 2015-06-11T02:18:40+0000
EXCHANGE _ID : 410
EXCHANGE_DTTM : 2015-06-11T02:12:28+0000
PART_NAME : LR04
PART_TRANS_ID : JAS04
M_NAME : FAILED
M_DTTM : 2015-06-11T02:12:28+0000
Here's what I've tried so far:
awk '{ for (i = 1; i <= NF; i++) f[i] = f[i] " " $i ; if (NF > n) n = NF } END { for (i = 1; i <= n; i++) sub(/^ */, "", f[i]) ; for (i = 1; i <= n; i++) print f[i] } ' FAILED.csv > TGT_FAILED.out
but that just prints things out a CSV instead of the desired format. Here's an example of the actual output, as opposed to the desired output from above:
EXCHANGE_ID EXCHANGE_DTTM PART_NAME PART_TRANS_ID M_NAME M_DTTM
: : : : : :
192, 2015-06-11+02:18:40+0000, MRT, 123, FAILED, 2015-06-11T02:18:40+0000
410, 2015-06-11+02:12:28+0000, LR04, JAS04, FAILED, 2015-06-11T02:12:28+0000