extract numbers from report-best method? 
Author Message
 extract numbers from report-best method?

I have these reports I need to extract numbers from and import into
excel.  I am not quite sure where to start but I thought of using a
series of if statements to get to the correct table.

if (m/TEST SUMMARY TABLE/){
   if (m/TEST 2/){

then I will need to grab the 4th percent under TEST 3 (58.9).
This is where I am really drawing a blank and can't figure out
how I will get the number.  Any suggestions?

As an aside I will eventually need to take this number and put
it in a predetermined Excel spreadsheet in col D, row 2.  I
know there is an Excel module but I have never seen or used it.

Lance

TABLE 181                                                          
TEST SUMMARY TABLE                                                  
Q.DVDTOT                                                            

                     TOTAL
                     ACTIV ONLY  RESPS MEMBR MEMBR RESPS MEMBR MEMBR
                     ----- ----- ----- ----- ----- ----- ----- -----
                       (A)   (B)   (C)   (D)   (E)   (F)   (G)   (H)

TOC_HYPERLINK                                                      
BASE                   483   127   337   258    79*  228   175    53

OVERALL TEST(NET)      337    45   337   258    79   228   175    53
                      69.8  35.4 100.0 100.0 100.0 100.0 100.0 100.0

 TEST 2                228    11   228   175    53   228   175    53
                      47.2   8.7  67.7  67.8  67.1 100.0 100.0 100.0

 TEST 3                188    35   188   152    36   113    88    25
                      38.9  27.6  55.8  58.9  45.6  49.6  50.3  47.2



Sun, 17 Apr 2005 00:31:41 GMT  
 extract numbers from report-best method?
I am a newbie Perl programmer, but a couple of methods come
to mind.  unpack() seems made to parse your fixed-lenght data.
Also, though ugly and highly input dependent, you can do something
like:

^\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)

and $4 will have the 4th entry on the line.

Before you go to all the trouble of writing a perl script, maybe
you just want Excel to parse it for you and then you make
referece to specific cells in the "master" spreadsheet.

== Rob ==


Quote:
> I have these reports I need to extract numbers from and import into
> excel.  I am not quite sure where to start but I thought of using a
> series of if statements to get to the correct table.

> if (m/TEST SUMMARY TABLE/){
>    if (m/TEST 2/){

> then I will need to grab the 4th percent under TEST 3 (58.9).
> This is where I am really drawing a blank and can't figure out
> how I will get the number.  Any suggestions?

> As an aside I will eventually need to take this number and put
> it in a predetermined Excel spreadsheet in col D, row 2.  I
> know there is an Excel module but I have never seen or used it.

> Lance

> TABLE 181
> TEST SUMMARY TABLE
> Q.DVDTOT

>                      TOTAL
>                      ACTIV ONLY  RESPS MEMBR MEMBR RESPS MEMBR MEMBR
>                      ----- ----- ----- ----- ----- ----- ----- -----
>                        (A)   (B)   (C)   (D)   (E)   (F)   (G)   (H)

> TOC_HYPERLINK
> BASE                   483   127   337   258    79*  228   175    53

> OVERALL TEST(NET)      337    45   337   258    79   228   175    53
>                       69.8  35.4 100.0 100.0 100.0 100.0 100.0 100.0

>  TEST 2                228    11   228   175    53   228   175    53
>                       47.2   8.7  67.7  67.8  67.1 100.0 100.0 100.0

>  TEST 3                188    35   188   152    36   113    88    25
>                       38.9  27.6  55.8  58.9  45.6  49.6  50.3  47.2



Mon, 18 Apr 2005 02:06:13 GMT  
 extract numbers from report-best method?

4th element would be $line[3];


Quote:
> I am a newbie Perl programmer, but a couple of methods come
> to mind.  unpack() seems made to parse your fixed-lenght data.
> Also, though ugly and highly input dependent, you can do something
> like:

> ^\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)

> and $4 will have the 4th entry on the line.

> Before you go to all the trouble of writing a perl script, maybe
> you just want Excel to parse it for you and then you make
> referece to specific cells in the "master" spreadsheet.

> == Rob ==



> > I have these reports I need to extract numbers from and import into
> > excel.  I am not quite sure where to start but I thought of using a
> > series of if statements to get to the correct table.

> > if (m/TEST SUMMARY TABLE/){
> >    if (m/TEST 2/){

> > then I will need to grab the 4th percent under TEST 3 (58.9).
> > This is where I am really drawing a blank and can't figure out
> > how I will get the number.  Any suggestions?

> > As an aside I will eventually need to take this number and put
> > it in a predetermined Excel spreadsheet in col D, row 2.  I
> > know there is an Excel module but I have never seen or used it.

> > Lance

> > TABLE 181
> > TEST SUMMARY TABLE
> > Q.DVDTOT

> >                      TOTAL
> >                      ACTIV ONLY  RESPS MEMBR MEMBR RESPS MEMBR MEMBR
> >                      ----- ----- ----- ----- ----- ----- ----- -----
> >                        (A)   (B)   (C)   (D)   (E)   (F)   (G)   (H)

> > TOC_HYPERLINK
> > BASE                   483   127   337   258    79*  228   175    53

> > OVERALL TEST(NET)      337    45   337   258    79   228   175    53
> >                       69.8  35.4 100.0 100.0 100.0 100.0 100.0 100.0

> >  TEST 2                228    11   228   175    53   228   175    53
> >                       47.2   8.7  67.7  67.8  67.1 100.0 100.0 100.0

> >  TEST 3                188    35   188   152    36   113    88    25
> >                       38.9  27.6  55.8  58.9  45.6  49.6  50.3  47.2



Sun, 24 Apr 2005 01:51:41 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. extract numbers from col/row report

2. Perl line numbers vs Apache error_log reported numbers?

3. extract colum of data from report which has page headers (how can i)

4. Best tool for generating pdf reports on unix?

5. Bug in line-number reporting?

6. extract number from binary string

7. regex to extract number

8. versions 2.1 (extract version number of programs)

9. A better way to extract a substring?

10. better way to extract portion of a string

11. Extracting number from an string

12. How to: Create Regex which extracts N number of words before target word

 

 
Powered by phpBB® Forum Software