in reply to Re: Parsing Log File Help!
in thread Parsing Log File Help!

Yes, the data file looks like :
Company Name*345467*YW34567c*activitype*04/15/2004*11:34:10*123456789*1
Thanks

Replies are listed 'Best First'.
Re: Re: Re: Parsing Log File Help!
by gsiems (Deacon) on Apr 15, 2004 at 15:14 UTC
    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...