in reply to Extracting ranged data

THis is quick and dirty and just assumes that your data is structured the way you did in your post.
#!/usr/bin/perl open IN, "in.txt" or die "Can't Open input\n"; $count = 0; while (<IN>) { chomp($_); if ($_ =~ /Users/) { print $_,"\t=\t"; } elsif ($_ =~ /\.\.\./) { print $count,"\n"; $count = 0; } else { if ($_) { $count++; } } }
gives this as a result from your example data
Users of some feature = 3 Users of some other feature = 3 Users of yet another feature = 0


BigGuy
"One World, one Web, one Program" - Microsoft promotional ad
"Ein Volk, ein Reich, ein Fuhrer" - Adolf Hitler

Replies are listed 'Best First'.
Re: Re: Extracting ranged data
by blaze (Friar) on Jul 24, 2002 at 21:21 UTC
    Like BigGuy said, his example is assuming that you have one text file set up exactly like what you have posted which looks like:
    Users of some feature
    
       user1
       user2
       user3
       ...
    
    Users of some other feature
    
       user1
       user2
       user3
       ...
    
    Users of yet another feature
    
    ...
    
    Is that the case?