Philip Neukom wrote:
> 
> Hi!

Hello,

> 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.

That's fine, that is one of the reasons Perl was created.

> 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?

I would love to help, but ...

> 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].

The two files in the other message aren't labeled and it isn't clear
which is relevant ...

> 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?

If you don't know how to describe what you want to do in Perl, try to
describe it in English.



John
-- 
use Perl;
program
fulfillment

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

Reply via email to