我有一个原始文件(gx.txt),其示例内容如下所示。
TIME;PCS/Main:GxCCAInitialSuccES;PCS/Main:GxCCAInitialSuccSILP;PCS/Main:GxCCATermSuccES;PCS/Main:GxCCATermSuccSILP;PCS/Main:GxCCAUpdateSuccES;PCS/Main:GxCCAUpdateSuccSILP;PCS/Main:GxCCRTermER;PCS/Main:GxCCRTermRILP;PCS/Main:GxCCRUpdateER;PCS/Main:GxCCRUpdateRILP;PCS/Main:GxMsgsES;PCS/Main:GxMsgsSentInLP;PCS/Main:GxPdpActivatesCLP;PCS/Main:GxPdpActivatesEC;PCS/Main:GxRAAFailER;PCS/Main:GxRAAFailRILP;PCS/Main:GxRAASuccER;PCS/Main:GxRAASuccRILP;PCS/Main:GxRAATimeOutER;PCS/Main:GxRAATimeOutRILP;PCS/Main:GxRARMsgES;PCS/Main:GxRARMsgSILP;PCS/Main:GxReqRejCLP;PCS/Main:GxReqRejEC;PCS/Main:GxUsageLimitExcCLP;PCS/Main:GxUsageLimitExcEC;PCS/Main:InvGxMsgsEverRcvd;PCS/Main:InvGxMsgsRcvdInLP;PCS/Main:OvldGxMsgsEverDropped;PCS/Main:RejNoOvldGxMsgsES;PCS/Main:RejNoOvldGxMsgsSILP;PCS/Main:RejOvldGxMsgsES;PCS/Main:RejOvldGxMsgsSILP;PCS/Main:ValGxMsgsEverRcvd;PCS/Main:ValGxMsgsRcvdInLP
2019/04/10-00:00:02;4005562825;18;3989951535;40;1595046173;27;4011647600;40;1596056209;27;9607664015;86;18;4015227947;839860;0;3411465;0;72319;0;4387265;2;0;12420;0;0;105108;0;5157;8519366;0;2388;0;9614481646;85
我使用以下命令来提取特定数据:
$ awk -F ";" '{print $1,$35,$12,($35-$12),$15,$2,$10,$6,$8,$4,$22,$18,$22}' gx.txt
TIME PCS/Main:ValGxMsgsEverRcvd PCS/Main:GxMsgsES 0 PCS/Main:GxPdpActivatesEC PCS/Main:GxCCAInitialSuccES PCS/Main:GxCCRUpdateER PCS/Main:GxCCAUpdateSuccES PCS/Main:GxCCRTermER PCS/Main:GxCCATermSuccES PCS/Main:GxRARMsgES PCS/Main:GxRAASuccER PCS/Main:GxRARMsgES
2019/04/10-00:00:02 9614481646 9607664015 6817631 4015227947 4005562825 1596056209 1595046173 4011647600 3989951535 4387265 3411465 4387265
我想将以下列标题分配给输出。
Date Valid_Gx_Rec Gx_sent Gx_Drop CCR_I_rec CCA_I_sent CCR_U_rec CCR_U_sent CCR_T_rec CCA_T_sent RAR_sent RAA_rec RAA_timeout