Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: parsing a file to get the count alone
by dewey (Pilgrim) on Nov 07, 2006 at 05:34 UTC
    I don't really understand what you are asking for here. In order to make the most of the site, please take a look at How (Not) To Ask A Question. Thanks!
    Now, given your post, I am guessing you may find (Count the number of lines in a file) useful. It is a little bit obfuscated, but it can be run straight from the command line. If this doesn't help, could you clarify what you mean by "elements"?
    ~dewey
Re: parsing a file to get the count alone
by reneeb (Chaplain) on Nov 07, 2006 at 09:58 UTC
    Maybe you need something like this:

    #!/usr/bin/perl use strict; use warnings; local $/ = "\nGenerating"; while(my $entry = <DATA>){ my ($table,$count) = $entry =~ /Summary of ([^\s]+).*(\d+)/s; print $table,": ",$count,"\n" if $count > 1; } __DATA__ Generating Summary of table_1 (count(*)) 1 Generating Summary of table_2 (count(*)) 2
      I guess that is (close to) what Anonymous Monk wanted.

      Just a small remark, [^\s]+ can be written /S+ in your regex.

      -- Hofmator

      Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.