I have a log with the following texts. I need to replace GX81CBCCONVCH10 with the string GX4APDOCUGRLK10 / GX4DODOCGRPGT30 /.. in next line. And then delete the next two lines. Can anyone help with any sed or awk command to do that. Or any python scripts.
I was replacing in vim with the following command but it does not work in sed.
:s/\(^.*\)GX81CBCCONVCH10\(.*\n\)\(.*EXT;\)\(.*;.*;.*;\)\(.*\)\(;.*;.*\n.*RTC.*\)/\1\5\2/g
Log:
20220812 090258078;1;2727;SVC;GX81CBCCONVCH10;;10.115.48.238;1.015;0.023;0.996;0.014;4096;820;1;0.995;3;0.009
20220812 090258078;1;2727;EXT;SwitchOAIntf;0.995;0.000;GX4APDOCUGRLK10;P;RIDD08B825RQ11DC
20220812 090258078;1;2727;RTC;2;0;0;0;0;2;0;0;1;0;0.00060;0.00000
20220812 090303106;1;2727;SVC;GX81CBCCONVCH10;;10.115.48.238;1.119;0.028;1.106;0.018;4096;1084;1;1.105;3;0.003
20220812 090303106;1;2727;EXT;SwitchOAIntf;1.105;0.000;GX4DODOCGRPGT30;P;RIDO2PCD35RQ11DC
20220812 090303106;1;2727;RTC;2;0;0;0;0;2;0;0;1;0;0.00065;0.00000
20220812 090308239;1;2727;SVC;GX81CBCCONVCH10;;10.115.48.238;0.896;0.031;0.883;0.021;4096;1084;1;0.881;3;0.003
20220812 090308239;1;2727;EXT;SwitchOAIntf;0.881;0.000;GX4DODOCGRPGT50;P;RIDWNKFI35RQ11DC
20220812 090308239;1;2727;RTC;2;0;0;0;0;2;0;0;1;0;0.00060;0.00000
20220812 090309137;1;2727;SVC;GX81CBCCONVCH10;;10.115.48.238;0.878;0.022;0.868;0.015;4096;820;1;0.867;3;0.003
20220812 090309137;1;2727;EXT;SwitchOAIntf;0.867;0.000;GX4APDOCUGRLK10;P;RIDZACDJ35RQ11DC
20220812 090309137;1;2727;RTC;2;0;0;0;0;2;0;0;1;0;0.00060;0.00000
The output should be like:
20220812 090258078;1;2727;SVC;GX4APDOCUGRLK10;;10.115.48.238;1.015;0.023;0.996;0.014;4096;820;1;0.995;3;0.009
20220812 090303106;1;2727;SVC;GX4DODOCGRPGT30;;10.115.48.238;1.119;0.028;1.106;0.018;4096;1084;1;1.105;3;0.003
20220812 090308239;1;2727;SVC;GX4DODOCGRPGT50;;10.115.48.238;0.896;0.031;0.883;0.021;4096;1084;1;0.881;3;0.003
20220812 090309137;1;2727;SVC;GX4APDOCUGRLK10;;10.115.48.238;0.878;0.022;0.868;0.015;4096;820;1;0.867;3;0.003