note
pklausner
No recursion needed here. This is simple awk-style stream processing like in the (untested!) sample. Re-arrange the sequence of the matching rules to include/exclude the leading/ending patterns for your hostname sections.
<code>while (<>)
{
/^hostname/ and do {
$host_section = 1;
++$tot; # number of hostnames
};
if ($host_section) {
print $_;
++$tot2; # lines in host sections
# do some processing...
}
/^end-of-hostname-pattern/ and do {
$host_section = 0;
};
}</code>
1041033
1041033