extract keyword

hi this is my text file sample.
I'm able to extract all the keywords that i want , except for "coplanarity"
I want to be able to extract the coplanarity's "defect" column's value.
Can someone pls help me?
thankS


GQ5.3C.04                       YIELD REPORT          : mils
Job     : PQFP64-ASAT-14x14-LIS    Start Date: 07/29/04
Tray    : ABC          Start Time: 12:21:13
Package : ABC          Sensor Ht.: 239.17 mils
Operator: TAN          Run Time  : 23:28:21
Mach S/N: LKJ          Lot       : 123
__________________________________________________________________________
NUMBER OF DEVICES INSPECTED : 23
NUMBER OF DEVICES ACCEPTED  : 23         YIELD : 100.00%
NUMBER OF DEVICES REJECTED  : 0
__________________________________________________________________________
CAUSE FOR REJECTION           INSPECTION LIMITS   DEFECT   REWORK
COPLANARITY                    0.02  to    1.36      0        0
TRUE POS SPREAD               -5.98  to    5.98      0        0
MARK INSPECTION OFF              NA                  0        0
FAILED TO SEGMENT                NA                           0
MISSING DEVICE                   NA                          23


This is the Perl codes.

#!/usr/bin/perl
    use strict;
    use warnings;

    use DBI;
    use Date::Manip;
    use File::Spec::Functions qw(curdir rel2abs);
    use File::Find;

    my( $dbh, $sth, $query );

    $dbh = DBI->connect( 'dbi:mysql:rvsi', '', '', {RaiseError=>1, PrintError=>1} );
    $query = 'replace into yield2 ( job, date, lot, report, dir, qin, qout, yield, reject ) values ( ?,?,?,?,?,?,?,?,?)';
    $sth = $dbh->prepare( $query );

    find(
    sub{
        return unless -f;
       
        print "Processing $_\n";

        @ARGV = ($_);
        my ($report, $job, $lot, $date, $fname, $qin, $qout, $yield, $reject);

        {
            local $_ = join '', <>;
            tr/\xA0//;  ## I had to do this for one of your sample records, or it wouldn't match

            ($report) = /(Yield Report)/i;
            ($job)= /Job\s*:\s*(\S+)\s*/i;
            ($date) = /Start Date\s*:\s*(\S+)\s*/i;
            ($lot) = /Lot\s*:\s*(.*)/i;
            ($qin) = /NUMBER OF DEVICES INSPECTED\s*:\s*(.*)/i;
            ($qout) = /NUMBER OF DEVICES ACCEPTED\s*:\s*(\S+)\s*/i;
            ($yield) = /YIELD\s*:\s*(.*)/i;
            ($reject) = /NUMBER OF DEVICES REJECTED\s*:\s*(.*)/i;


            $fname = rel2abs( $ARGV);

            print "I found the following values:\n";
            print "\tReport: >$report<\n";
            print "\tJob: >$job<\n";
            print "\tDate: >$date<\n\n";
            print "\tLot: >$lot<\n";
            print "\tNumber of Devices Inspected: >$qin<\n";
            print "\tNumber of Devices Accepted: >$qout<\n";
            print "\tYield: >$yield<\n";
            print "\tNumber of Devices Rejected: >$reject<\n";

            # check if there is any values in job, it will insert the whole line of entRies in
            if($job){
                # We have a full record            
               

                print "Inserting record... ";
                $sth->execute($job, $date, $lot, $report, $fname, $qin, $qout, $yield, $reject);
                print "done.\n\n";
            }
        }
    },".");


TPolyAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
That looks like $defect should be 0, why do you say it should be 9?
To get the 0 and not the 0.0 you could use

($defect) = /COPLANARITY\s+\S+\s+\S+\s+\S+\s+(\d+)\D+\d+\s*$/i;
0
 
ozoCommented:
($defect) = /COPLANARITY\b.+(\d+)\D+\d+/i;
0
 
TPolyAuthor Commented:
hi
i tried
it did extract the info out
but it does not match with the corresponding text file
(meaning wrong or no info)
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
ozoCommented:
Could you show a sample for which it gives the wrong info and what the info should have been?
0
 
TPolyAuthor Commented:
the value of the coplanarity is 9 but output catched is 5.
0
 
ozoCommented:
What did the input line look like to specify that the value should be 9?
0
 
TPolyAuthor Commented:
CAUSE FOR REJECTION           INSPECTION LIMITS   DEFECT   REWORK
COPLANARITY                    0.02  to    1.36      9        0

I want to extract coplanarity's defect value.
The value is 9
but when i check against the db, the value is different, in this case is 5
0
 
ozoCommented:
Does the word "coplanarity" appear anywhere else in the input?
0
 
TPolyAuthor Commented:
yes it does

It looked like this:



GQ5.3C.04                       YIELD REPORT          : microns
Job     : abc                    Start Date: 08/11/04    
Tray    : 123                    Start Time: 09:57:05    
Package : Sin                    Sensor Ht.: 167.72 mils
Operator: JAMES                  Run Time  : 09:57:05    
Mach S/N: plk                    Lot       : goO          
__________________________________________________________________________
NUMBER OF DEVICES INSPECTED : 1
NUMBER OF DEVICES ACCEPTED  : 1           YIELD : 100.00%
NUMBER OF DEVICES REJECTED  : 0
__________________________________________________________________________
CAUSE FOR REJECTION           INSPECTION LIMITS   DEFECT   REWORK
COPLANARITY                    0.00  to   25.01      0        0
TRUE POS SPREAD              -69.23  to   69.23      0        0
MARK INSPECTION OFF              NA                  0        0
FAILED TO SEGMENT                NA                           0
MISSING DEVICE                   NA                           0

FAILED TO SEGMENT    Side 1: 0, Side 2: 0, Side 3: 0, Side 4: 0



____________________________________________________________________________________________________________________

CAPABILITY ANALYSIS       LSL   NOMINAL       USL       MIN      MEAN       MAX     SIGMA    3SIGMA      Cp     Cpk
____________________________________________________________________________________________________________________
COPLANARITY               0.0       0.0      2.0      35.6      48.4      48.5       0.0       0.0     0.0     0.0
TRUE POS. SPREAD        -36.0       0.0      4.0     -169.0     0.9       69.0       4.8      14.5     5.1     5.1
0
 
TPolyAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.