0

I have to compare two different log files line by line (in each line data between two symbols (: and ;) is to be checked) and print all lines of log 1 that are not in log 2.

If two or more lines have same set of info in log 1 then print just single line in output. I want to compare data of every line (data starting from first colon to appearance of a semicolon) irrespective whether it is a set of alphabet, numbers or special characters.

I need to use perl for my solution.

Log 1

INFO @0 digrf_0_drv: Constructing a digrf Driver: digrf_0_drv; T=0
INFO @603845 mcPWM_CYC: ----- SV is waiting for FLAG 4  -----; T=603845
INFO @1116033 mcPWM_CYC: ----- SV is waiting for FLAG 0  -----; T=1116033
INFO @1145215 mcPWM_CYC: ----- Flag 0 OK SV STARTED  -----; T=1145215
INFO @1145215 mcPWM_CYC: PORT STIM started !!!; T=1145215
INFO @1145287 mcPWM_CYC: ----- SV is waiting for FLAG 2  -----; T=1145287
INFO @1146281 mcPWM_CYC: ----- Flag 0 OK : SV STARTED  -----; T=1146281
INFO @1146281 mcPWM_CYC: PORT STIM started !!!; T=1146281
INFO @1190554 mcPWM_CYC: C-Code exit execution. code=<aa>; T=1190554
INFO @1190554 mti_lane1_bw_mon: total bytes = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane1_bw_mon: time window = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane1_bw_mon: BW in Mbps = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane2_bw_mon: total bytes = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane2_bw_mon: time window = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane2_bw_mon: BW in Mbps = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane3_bw_mon: total bytes = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane3_bw_mon: time window = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane3_bw_mon: BW in Mbps = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane4_bw_mon: total bytes = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane4_bw_mon: time window = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane4_bw_mon: BW in Mbps = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane5_bw_mon: total bytes = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane5_bw_mon: time window = 0, at time = 1190554; T=1190554
INFO @1190554 mti_lane5_bw_mon: BW in Mbps = 0, at time = 1190554; T=1190554
INFO: Report(s) of this encapsulation run can be found under:

Log2:

UVM_INFO @1353514 reporter [Z7_COREA]: mcPWM0_ExtSig: *** START Syncronization with Verilog Stimulus ***; T=1353514
UVM_INFO @1353578 reporter [Z7_COREA]: C FLAG_SET: Setting flag 0; T=1353578
UVM_INFO @1353578 reporter [Z7_COREA]: V FLAG_WAIT: Received flag 0; T=1353578
UVM_INFO @1353578 reporter [testbench.top_level_module.\mcPWM_CYC::main ]: ----- Flag 0 OK SV STARTED  -----; T=1353578
UVM_INFO @1353578 reporter [testbench.top_level_module.\mcPWM_CYC::main ]: PORT STIM started !!!; T=1353578
UVM_INFO @1353642 reporter [Z7_COREA]: C FLAG_WAIT: Checking flag 1, status is 0; T=1353642
UVM_INFO @1353650 reporter [Z7_COREA]: V FLAG_SET: Setting flag 1; T=1353650
UVM_INFO @1353650 reporter [testbench.top_level_module.\mcPWM_CYC::main ]: ----- SV is waiting for FLAG 2  -----; T=1353650
UVM_INFO @1353650 reporter [Z4_COREA]: V FLAG_WAIT: Checking flag 2, status is 0; T=1353650
UVM_INFO @1353743 reporter [Z7_COREA]: C FLAG_WAIT: Checking flag 1, status is 1; T=1353743
UVM_INFO @1354063 reporter [Z7_COREA]: REM16: A=fbc00086 R=0007 E=0007 M=ffff; T=1354063
UVM_INFO @1354336 reporter [Z7_COREA]: REM16: A=fbc00080 R=048e E=048e M=ffff; T=1354336
UVM_INFO @1354532 reporter [Z7_COREA]: W16: A=fbc00080 W=008d; T=1354532
UVM_INFO @1354597 reporter [Z7_COREA]: C FLAG_SET: Setting flag 2; T=1354597
UVM_INFO @1354597 reporter [Z7_COREA]: V FLAG_WAIT: Received flag 2; T=1354597
UVM_INFO @1354597 reporter [testbench.top_level_module.\mcPWM_CYC::main ]: ----- Flag 0 OK SV STARTED  -----; T=1354597
UVM_INFO @1354597 reporter [testbench.top_level_module.\mcPWM_CYC::main ]: PORT STIM started !!!; T=1354597
UVM_INFO @1354597 reporter [Z7_COREA]: V FLAG_WAIT: Received flag 2; T=1354597
UVM_INFO @1354597 reporter [Z7_COREA]: V FLAG_WAIT: Checking flag 2, status is 1; T=1354597
UVM_INFO @1354661 reporter [Z7_COREA]: C FLAG_WAIT: Checking flag 2, status is 1; T=1354661
UVM_INFO @1354741 reporter [Z7_COREA]: V FLAG_CLEAR: Clearing flag 2; T=1354741
UVM_INFO @1354741 reporter [Z4_COREA]: V FLAG_SET: Setting flag 5; T=1354741
UVM_INFO @1354741 reporter [Z7_COREA]: V FLAG_WAIT: Received flag 2; T=1354741

Expected Output:

Constructing a digrf Driver: digrf_0_drv
----- SV is waiting for FLAG 4  -----
----- SV is waiting for FLAG 0  -----
C-Code exit execution. code=<aa>
total bytes = 0, at time = 1190554
time window = 0, at time = 1190554
BW in Mbps = 0, at time = 1190554 
Report(s) of this encapsulation run can be found under
  • @roaima yes i need to use PERL only, till now i have tried a code but its not working fine, can you please help me out ? – Rahul Agarwal Mar 7 at 11:18
  • 2
    Can you show us the relevant part of your code that's not working? In this kind of situation it can sometimes be easier to fix a broken piece of code than to write it afresh. – roaima Mar 7 at 11:20
  • What is your code? What does it do? Exactly how is it not working? – L. Scott Johnson Mar 7 at 14:24
  • I have a solution, but I don't want to just give it to you before I see what you have attempted. – glenn jackman Mar 7 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.