while thinking about your last addition,
consider this
open IN,'<1';
while (<IN>) {
$a = 1 if /Endpoint/;
$b = 1 if /-/ and $a;
if($a and $b){
if(/^\s+(.+)\s\(/){
$h{$1}{'x'} = ++$x if ! exists $h{$1};
$r .= $h{$1}{'x'}.".";
}
}
$a = 0, $b = 0, ++$r{$r}, $r = '' if /data arrival time/ and $
+b;
}
close IN;
foreach (sort keys %r) {
print "$_: $r{$_}\n";
}
algorithm:
find /Endpoint/
find /-/
assign every line pattern a unique code from 1 towards infinity
form the unique string number, count it as one occurence
find /data arrival time/
which will result in something like this:
1.2.2.3.3.4.4.5.6.7.8.9.10.10.11.11.12.12.: 8
which means I copied your example file eight times in my '1' file
update
regarding your patterns:
they are quite confusing
why did you pick up the middle line to form your pattern?
Please consider this snippet above, maybe it will suit your needs as well?
update 2
have you tried this soultion? has it worked? please tell.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.