[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

09/08/2003 at 07:26AM PDT, ID: 20732192
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

need to parse error file - repost - please help!

Asked by xjeffk in Perl Programming Language

Tags: perl, time

Hi  - a couple people responded to this with incomplete answers  such as:

#!/usr/bin/perl

use strict;
use warnings;

$_ = do { local $/; <> };

my %tags = /(\w+\s?\w+):\s+(\S+)/g;

for (keys %tags) {
 print "$_ : $tags{$_}\n";
}

And here's the output from your sample file:

WARNINGS : 000000001
MANIFEST : 079608023
TIME : 10:16:29
RECEIPT DATE : 04/06/2002
MAILER : 077974868
GOOD RECORDS : 000000035
REPORT : CBD514C0
DATE : 04/06/2002
RECORDS READ : 000000035
MAILING DATE : 04/06/2002
EDIT ERRORS : 000000000
RECEIPT TIME : 10.16.29
PAGE : 1
ENTRY FACILITY : 06101




-->  this is great but does not address the following fields in the error file which instead of a tag value format use a header/column format.


ERR/   MANIFEST   WRN   LINE NO.        PIC                    ERROR FIELD            ERROR MESSAGE


     W   000000025   9102077974868200018250   07783                    INVALID DESTINATION ZIP CODE


The other outstanding issue is the error file could have have multiple reports - so i need to loop over it, but this is secondary.

LOOK !!! - A WORKING ANSWER IS WORTH 1000 POINTS TO ME - I NEED BY 5:00 EST PLEASE!  

THANKS,

JEFF







I need a solution - preferably a regex - that will parse the following tag value pairs of this error report:


USPS                                  PRODUCT TRACKING SYSTEM                                 PAGE:   1
REPORT: CBD514C0             MANIFEST DATA EDIT ERROR/WARNING LISTING                         DATE: 04/06/2002
                                                                                              TIME: 10:16:29

        MAILER:       077974868                               ENTRY FACILITY: 06101
        MANIFEST:     079608023                               MAILING DATE:  04/06/2002
        RECEIPT DATE: 04/06/2002
        RECEIPT TIME: 10.16.29


   ERR/   MANIFEST
   WRN   LINE NO.        PIC                    ERROR FIELD            ERROR MESSAGE


     W   000000025   9102077974868200018250   07783                    INVALID DESTINATION ZIP CODE



     RECORDS READ:    000000035

     EDIT ERRORS:     000000000

     WARNINGS:        000000001

     GOOD RECORDS:    000000035


As you'll see, I have a small program that reads in each line & a faulty regex that just grabs the "tags" not the values.  to run - save the above to  d:\\bill\\newTracking\\Usps\\errwrno1.rpt.04060822 save to any file & adjust the "open" line below accordingly.

i'm open to any working solution - speed would be good as it needs to read a million records - i'm guessing just an update to the regex as i'm clueless.

thanks so much

jeff




#!/usr/bin/perl
use DBI;




&doConn;

&doMain;


    ######################################################
    #
    #     Grab the file to parse, loop over line by line
    #
    ######################################################


    sub doMain{
         #open (LOGFILE, "$filename") or die "can't open $filename: $!";
         open (LOGFILE, "d:\\bill\\newTracking\\Usps\\errwrno1.rpt.04060822") or die "can't open $filename: $!";
         $naptime=1;
         undef($hostname);

             while (<LOGFILE>) {
              $line = $_;
              chomp($line);
             
               if ( $line ne "" ) {
               
                  &process_line($line);
                      print "-----------------n e x t-------------------\n";
              }

         }

         close ( LOGFILE );
    }


    ######################################################
    #
    #     Parse each line down to the desired element
    #
    ######################################################
   
     sub process_line() {


         #while($line)
            {
                if($line=~/^(.+?)\s+\d/)
               {
                 push(@$names, $1);
                 
                 
               }
           
             print "current value: @$names\n";

            }
                   
    }

[+][-]09/08/03 07:59 AM, ID: 9309949

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/08/03 11:40 AM, ID: 9311136

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/08/03 01:29 PM, ID: 9312025

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/08/03 01:37 PM, ID: 9312106

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/08/03 01:37 PM, ID: 9312112

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/08/03 01:47 PM, ID: 9312205

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/08/03 02:47 PM, ID: 9312678

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/08/03 03:02 PM, ID: 9312797

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/08/03 05:50 PM, ID: 9313681

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/08/03 07:01 PM, ID: 9313989

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/08/03 07:08 PM, ID: 9314023

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/08/03 08:06 PM, ID: 9314365

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: perl, time
Sign Up Now!
Solution Provided By: inq123
Participating Experts: 3
Solution Grade: A
 
 
[+][-]09/09/03 05:43 AM, ID: 9319807

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/09/03 03:53 PM, ID: 9324757

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/09/03 07:17 PM, ID: 9325624

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74