Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > SOS: Need help on this script if you can ...million thanks in advance

Reply
Thread Tools

SOS: Need help on this script if you can ...million thanks in advance

 
 
cyrusgreats@gmail.com
Guest
Posts: n/a
 
      10-17-2008
Hello good people out there. I need to write a perl script that will
parse the log and generate the following output:a flat text file in
the following format:

customer_name|product_category|item_description|co st

An example log file could be:
Pedro|groceries|apple|1.42
Nitin|tobacco|cigarettes|15.00
Susie|groceries|cereal|5.50
Susie|groceries|milk|4.75
Susie|tobacco|cigarettes|15.00
Susie|fuel|gasoline|44.90
Pedro|fuel|propane|9.60

1.A report of the total revenue resulting from each customer.
2.A report for each customer showing how much of their spending went
to each category.
With the above example log file, the script should output should be
something like:
Total Revenue:
Pedro - $11.02
Nitin - $15.00
Susie - $70.15

Purchases by Pedro:
groceries - $1.42
fuel - $9.60

Purchases by Nitin:
tobacco - $15.00

Purchases by Susie:
groceries - $10.25
fuel - $44.90
tobacco - $15.00

#!/usr/bin/perl
use strict;

my $file = "inventory";
open (FILE, $file) || die ("Could not open file. $!");

foreach my $line (FILE) {
my ($customer_name, $product_cat, $item_desc, $cost) = split("|",
$line);


what should I do here
Any help will be appreciated...million thanks in advanceHello good
people out there. I need to write a perl script that will parse the
log and generate the following output:
a flat text file in the following format: customer_name|
product_category|item_description|cost
An example log file could be:
Pedro|groceries|apple|1.42
Nitin|tobacco|cigarettes|15.00
Susie|groceries|cereal|5.50
Susie|groceries|milk|4.75
Susie|tobacco|cigarettes|15.00
Susie|fuel|gasoline|44.90
Pedro|fuel|propane|9.60

1.A report of the total revenue resulting from each customer.
2.A report for each customer showing how much of their spending went
to each category.
With the above example log file, the script should output should be
something like:
Total Revenue:
Pedro - $11.02
Nitin - $15.00
Susie - $70.15

Purchases by Pedro:
groceries - $1.42
fuel - $9.60

Purchases by Nitin:
tobacco - $15.00

Purchases by Susie:
groceries - $10.25
fuel - $44.90
tobacco - $15.00

#!/usr/bin/perl
use strict;

my $file = "inventory";
open (FILE, $file) || die ("Could not open file. $!");

foreach my $line (FILE) {
my ($customer_name, $product_cat, $item_desc, $cost) = split("|",
$line);


what should I do here
Any help will be appreciated...million thanks in advanceHello good
people out there. I need to write a perl script that will parse the
log and generate the following output:
a flat text file in the following format: customer_name|
product_category|item_description|cost
An example log file could be:
Pedro|groceries|apple|1.42
Nitin|tobacco|cigarettes|15.00
Susie|groceries|cereal|5.50
Susie|groceries|milk|4.75
Susie|tobacco|cigarettes|15.00
Susie|fuel|gasoline|44.90
Pedro|fuel|propane|9.60

1.A report of the total revenue resulting from each customer.
2.A report for each customer showing how much of their spending went
to each category.
With the above example log file, the script should output should be
something like:
Total Revenue:
Pedro - $11.02
Nitin - $15.00
Susie - $70.15

Purchases by Pedro:
groceries - $1.42
fuel - $9.60

Purchases by Nitin:
tobacco - $15.00

Purchases by Susie:
groceries - $10.25
fuel - $44.90
tobacco - $15.00

#!/usr/bin/perl
use strict;

my $file = "inventory";
open (FILE, $file) || die ("Could not open file. $!");

foreach my $line (FILE) {
my ($customer_name, $product_cat, $item_desc, $cost) = split("|",
$line);


what should I do here
Any help will be appreciated...million thanks in advanceHello good
people out there. I need to write a perl script that will parse the
log and generate the following output:
a flat text file in the following format: customer_name|
product_category|item_description|cost
An example log file could be:
Pedro|groceries|apple|1.42
Nitin|tobacco|cigarettes|15.00
Susie|groceries|cereal|5.50
Susie|groceries|milk|4.75
Susie|tobacco|cigarettes|15.00
Susie|fuel|gasoline|44.90
Pedro|fuel|propane|9.60

1.A report of the total revenue resulting from each customer.
2.A report for each customer showing how much of their spending went
to each category.
With the above example log file, the script should output should be
something like:
Total Revenue:
Pedro - $11.02
Nitin - $15.00
Susie - $70.15

Purchases by Pedro:
groceries - $1.42
fuel - $9.60

Purchases by Nitin:
tobacco - $15.00

Purchases by Susie:
groceries - $10.25
fuel - $44.90
tobacco - $15.00

#!/usr/bin/perl
use strict;

my $file = "inventory";
open (FILE, $file) || die ("Could not open file. $!");

foreach my $line (FILE) {
my ($customer_name, $product_cat, $item_desc, $cost) = split("|",
$line);


what should I do here
Any help will be appreciated...million thanks in advance
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      10-17-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
[Multiple copies of the same request]

Please see http://www.catb.org/~esr/faqs/smart-...ns.html#urgent

jue
 
Reply With Quote
 
 
 
 
Tad J McClellan
Guest
Posts: n/a
 
      10-18-2008
(E-Mail Removed) <(E-Mail Removed)> wrote:

> what should I do here



You should repeat your post a few dozen more times.


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cisco 2500 help/Newbie, thanks for the help in advance chrisadatl Cisco 5 03-20-2006 01:47 PM
Please explain following script for me. Thanks in advance. PerlPerl Perl Misc 12 05-30-2005 04:05 AM
Win XP help please (boot probs)If you get 5 mins take a look...thanks in advance Niall Computer Support 2 11-26-2004 12:13 AM
Help Please! Thanks in advance. Derek Richards Javascript 2 10-22-2003 04:48 PM
auto input number to output(help please thanks in advance!) david Javascript 3 08-14-2003 08:03 PM



Advertisments