Hi!
I have a huge print file in txt format that I would like to extract
data from, export to a new text file and then import into a database.
I am less concerned about efficiency as I am with getting this done
quick and dirty.

I am just starting out and am confused as hell.  As the multitude of
ways to do this run through my head I find I am getting no where.

Would some kind soul help this beginning beginer?

My file is ~350MB. (not attached of course) 
It has the structure as shown in the attachment [OrderSample.txt]. 
I have also attached an example of what the data should look like in
final form [OrderSampleFinished.txt].

Each record spans 3 lines. 

I am using ActivePerl.

#!c:\perl\perl -n

use strict;

while(/^Customer\:[ \t]+([\*\d+)[ \t]+(.+)/){
        chomp;
        my $customer = substr($_,2);
        while(/^([\*\d+|\d+][ \t]+([\d+])[ \t]([\d{2}\/[\d{2}\/[\d{2})
... select to end of third line)
        my $order = substr($_,19)
                while (<>){
                        next LINE if ($order(2) eq $order(2));
                        print "$customer$_" ""$order$_" > newfile.txt;
                }
        }
}

I'm not sure if while is going to work or if I should try to figure
out how to use foreach?

Any help greatly appreciated.
Philip

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to