Code:
#!/bin/ksh
sed -E 's/^(.{10}).{36}(.{3}).{34}(.{101})(.{26})/\1 \2 \4 \3/' in2 |
while read trackingnum trackingnumsuffix tstmpupdated text
do
echo Tracking: \"$trackingnum\", Suffix: \"$trackingnumsuffix\", Timestamp: \"$tstmpupdated\", Text: \"$text\"
done
$ ./parse.sh
Tracking: "", Suffix: "", Timestamp: "", Text: ""
Tracking: "BEYJYWG83L", Suffix: "902", Timestamp: "2008-09-10-00.41.32.787352", Text: "System Exception Occured, please refer to BMW_EXCEPTION_LOG table"
Tracking: "BEYJYXMT4K", Suffix: "902", Timestamp: "2008-09-11-19.01.23.878551", Text: "System Exception Occured, please refer to BMW_EXCEPTION_LOG table"
Tracking: "BEYEHF93QY", Suffix: "003", Timestamp: "2008-08-28-16.31.01.881717", Text: "No message exists in ZBV_BILL_REJCT_RSN table"
Tracking: "BEYJYTT8FQ", Suffix: "013", Timestamp: "2008-09-04-17.39.04.005237", Text: "Invalid Transaction Code"
Tracking: "BEYJYTT8FQ", Suffix: "016", Timestamp: "2008-09-04-17.39.04.008137", Text: "Invalid Fee Code"
Tracking: "BEYJYTT8FQ", Suffix: "016", Timestamp: "2008-09-04-17.39.04.011939", Text: "Invalid Fee Code"
Tracking: "BEYJYTT8FQ", Suffix: "016", Timestamp: "2008-09-04-17.39.04.012851", Text: "Invalid Fee Code"
Tracking: "BEYJY2SZVL", Suffix: "003", Timestamp: "2008-09-16-09.22.29.120192", Text: "Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG"
Tracking: "BEYJY2SXNG", Suffix: "003", Timestamp: "2008-09-16-09.19.33.868772", Text: "Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG"
Tracking: "BEYJY2SMS3", Suffix: "003", Timestamp: "2008-09-16-08.53.07.872138", Text: "Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG"
Tracking: "BEYJY2SMJD", Suffix: "003", Timestamp: "2008-09-16-08.50.17.307262", Text: "Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG"
Tracking: "BEYJY2EG2K", Suffix: "003", Timestamp: "2008-09-17-15.56.03.418917", Text: "Policy / Contract Account Number are pending in the ZB_MASTER_DATA_LOG"