#!/usr/bin/env perl use strict; use warnings; my $meta = 1; my $pin_meta = 1; my @pins; while () { chomp; next unless /\S/; if ($meta) { if (0 == index $_, '-') { $meta = 0; next; } else { if ($pin_meta) { if (/^\s*VecAddr/) { $pin_meta = 0; } else { my @chars = map { /[[\]]/ ? '' : $_ } split //, (/(\S+)\s*$/)[0]; $pins[$_] .= $chars[$_] for 0 .. $#chars; } } } } else { my ($cycle, $pin_str) = (split)[3,4]; my @pin_str_chars = split //, $pin_str; for (0 .. $#pin_str_chars) { next unless $pin_str_chars[$_] =~ /[hl]/; print "$cycle $pins[$_] $pin_str_chars[$_]\n"; } } } __DATA__ 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..........................