kshitij has asked for the wisdom of the Perl Monks concerning the following question:
E HI Guys , I am not new to Perl but I am getting an issue and not able to understand how to write a script for the below stated problem. Problem Description : I am having one file and I need to create a file with some pattern match as stated below Input File
PINS PPPPPPPPPPPPPPP DDDDDDDDDDDEEEE [[[[[[[[[[[[[[[[ 198765432105432 0]]]]]]]]]]]]]]] ] + + + + VecAddr RptCnt VmemAddr Cycle + ------------------------------- ------ -------- ----- ---------------- +---------------- Pat6_Scan_comp_at_speed_m:24791 1 6156500 25701 .......h........ +................ Pat6_Scan_comp_at_speed_m:24884 1 6156593 25794 .h....h......... +................ Pat6_Scan_comp_at_speed_m:24891 1 6156600 25801 ...h.....h...... +................ Pat6_Scan_comp_at_speed_m:26759 1 6158468 27689 ................ +................ Pat6_Scan_comp_at_speed_m:29196 1 6160905 30160 ................ +................ Pat6_Scan_comp_at_speed_m:30671 1 6162380 31650 ....h.h......... +................ Pat6_Scan_comp_at_speed_m:30982 1 6162691 31966 .....hl......... +................ Pat6_Scan_comp_at_speed_m:30985 1 6162694 31969 .....h.......... +................ Pat6_Scan_comp_at_speed_m:30986 1 6162695 31970 .....l.......... +................ Pat6_Scan_comp_at_speed_m:31276 1 6162985 32266 ......h......... +................ Pat6_Scan_comp_at_speed_m:31562 1 6163271 32557 ................ +................ Pat6_Scan_comp_at_speed_m:31563 1 6163272 32558 ................ +................ Pat6_Scan_comp_at_speed_m:31593 1 6163302 32588 .......h........ +................ Pat6_Scan_comp_at_speed_m:31594 1 6163303 32589 .......h........ +................ Pat6_Scan_comp_at_speed_m:31637 1 6163346 32632 ........l....... +................ Pat6_Scan_comp_at_speed_m:31639 1 6163348 32634 ........l....... +................ Pat6_Scan_comp_at_speed_m:31645 1 6163354 32640 ..h............. +................ Pat6_Scan_comp_at_speed_m:31646 1 6163355 32641 ..l............. +................ Pat6_Scan_comp_at_speed_m:31647 1 6163356 32642 ..l............. +................ Pat6_Scan_comp_at_speed_m:31650 1 6163359 32645 ..h............. +................ Pat6_Scan_comp_at_speed_m:31656 1 6163365 32651 .......h........ +................ Pat6_Scan_comp_at_speed_m:31697 1 6163406 32692 ...l.h.......... +................ Pat6_Scan_comp_at_speed_m:31703 1 6163412 32698 .....h.......... +................ Pat6_Scan_comp_at_speed_m:31704 1 6163413 32699 ...l.l.......... +................ Pat6_Scan_comp_at_speed_m:31705 1 6163414 32700 ...h.h.......... +................ Pat6_Scan_comp_at_speed_m:31706 1 6163415 32701 ...h.h.......... +................ Pat6_Scan_comp_at_speed_m:31707 1 6163416 32702 ...l.h.......... +................ Pat6_Scan_comp_at_speed_m:31708 1 6163417 32703 ...l.l.......... +................ Pat6_Scan_comp_at_speed_m:31713 1 6163422 32708 .........l...... +................ Pat6_Scan_comp_at_speed_m:31715 1 6163424 32710 ........l....... +................ Pat6_Scan_comp_at_speed_m:31723 1 6163432 32718 .........l...... +................ Pat6_Scan_comp_at_speed_m:31725 1 6163434 32720 ........lh...... +................ Pat6_Scan_comp_at_speed_m:31728 1 6163437 32723 ........l....... +................ Pat6_Scan_comp_at_speed_m:31730 1 6163439 32725 .........h...... +................ Pat6_Scan_comp_at_speed_m:31738 1 6163447 32733 .ll............. +................ Pat6_Scan_comp_at_speed_m:31739 1 6163448 32734 .hh............. +................ Pat6_Scan_comp_at_speed_m:31740 1 6163449 32735 .lh.hl.......... +................ Pat6_Scan_comp_at_speed_m:31750 1 6163459 32745 ....lh.......... +................ Pat6_Scan_comp_at_speed_m:31751 1 6163460 32746 ....hh.......... +................ Pat6_Scan_comp_at_speed_m:31752 1 6163461 32747 ....hl.......... +................ Pat6_Scan_comp_at_speed_m:31757 1 6163466 32752 .......l.h...... +................ Pat6_Scan_comp_at_speed_m:31779 1 6163488 32774 .h.............. +................ Pat6_Scan_comp_at_speed_m:31781 1 6163490 32776 .h.............. +................ Pat6_Scan_comp_at_speed_m:31808 1 6163517 32803 ..h............. +................ Pat6_Scan_comp_at_speed_m:31818 1 6163527 32813 .h.l............ +................ Pat6_Scan_comp_at_speed_m:31819 1 6163528 32814 .h.h............ +................ Pat6_Scan_comp_at_speed_m:31824 1 6163533 32819 .l.h............ +................ Pat6_Scan_comp_at_speed_m:31825 1 6163534 32820 .......hh....... +................ Pat6_Scan_comp_at_speed_m:31829 1 6163538 32824 .hh............. +................ Pat6_Scan_comp_at_speed_m:31831 1 6163540 32826 .l....l..l...... +................ Pat6_Scan_comp_at_speed_m:31833 1 6163542 32828 .lh............. +................ Pat6_Scan_comp_at_speed_m:31836 1 6163545 32831 .hl............. +................ Pat6_Scan_comp_at_speed_m:31837 1 6163546 32832 .lh............. +................ Pat6_Scan_comp_at_speed_m:31838 1 6163547 32833 .lh............. +................ Pat6_Scan_comp_at_speed_m:31839 1 6163548 32834 .lh............. +................ Pat6_Scan_comp_at_speed_m:31840 1 6163549 32835 .lh............. +................ Pat6_Scan_comp_at_speed_m:31842 1 6163551 32837 .lh............. +................ Pat6_Scan_comp_at_speed_m:31843 1 6163552 32838 .hl............. +................ Pat6_Scan_comp_at_speed_m:31845 1 6163554 32840 .hh............. +................ Pat6_Scan_comp_at_speed_m:31859 1 6163568 32854 ....h........... +................ Pat6_Scan_comp_at_speed_m:31867 1 6163576 32862 ...l............ +................ Pat6_Scan_comp_at_speed_m:31868 1 6163577 32863 ...h............ +................ Pat6_Scan_comp_at_speed_m:31869 1 6163578 32864 ...h............ +................
Now the script should match with the "h" and "l" characters of the pins with the corresponding pins at the top . Each dot "." in the 5th Column of the input file is representing the pin which is there at the top for example first "." represents PD10 , second "." represents PD9 etc ...So wherever the script match with h and l , it should pick the corresponding pin of the top and print in the output file Output file should be having the 4th Column which is cycle number and the pin name and the "h" or "l" character of the corresponding pin For example , Output file should be like this Output file
Cycle Pin-name expected-value 25701 PD3 h 25794 PD4 h 25794 PD9 h
Thanks Kshitij
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help in getting a perl script for below logic
by tybalt89 (Monsignor) on Feb 09, 2019 at 07:54 UTC | |
by kshitij (Sexton) on Feb 11, 2019 at 06:56 UTC | |
|
Re: Need help in getting a perl script for below logic
by poj (Abbot) on Feb 09, 2019 at 07:50 UTC | |
|
Re: Need help in getting a perl script for below logic
by kcott (Archbishop) on Feb 09, 2019 at 22:40 UTC |