in reply to Parsing Log File Help!

Got some sample data for us to chew on? Your regex is very suspect. If we had sample data we could help you figure out the right regex to use.

Replies are listed 'Best First'.
Re: Re: Parsing Log File Help!
by Anonymous Monk on Apr 15, 2004 at 10:17 UTC
    Yes, the data file looks like :
    Company Name*345467*YW34567c*activitype*04/15/2004*11:34:10*123456789*1
    Thanks
      If I'm reading this correctly, try:
      foreach (<LOGFILE>) { @fields = split '*', $_; # ... blah, blah, blah ... }
      as for the counting... not sure I follow. If you're trying to count the number of times a specific value shows up in a field (i.e., number of times "company abc", "company xyz", etc. show up in the "company name" field) then perhaps something like:
      %company_count; foreach (<LOGFILE>) { ($company_name, ...) = split '*', $_; $company_count{$company_name} ++; } # foreach sort (keys %company_count) { foreach (sort keys %company_count) { print $_, " showed up ", $company_count{$_}, " times\n"; }
      fits the bill...