For Programmers: Free Programming Magazines  


Home > Archive > PERL Programming > October 2004 > data separation and calculation









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author data separation and calculation
xtravel

2004-10-16, 4:48 am

i have a file with data as follows;

==============================
Field1 | Field2 | Field3|
==============================
771323 | 02.00 min | 30.00 |
771323 | 04.00 min | 40.00 |
771323 | 05.00 min | 50.00 |
771323 | 06.00 min | 60.00 |
771323 | 07.00 min | 70.00 |
829999 | 02.00 min | 30.00 |
829999 | 04.00 min | 40.00 |
781222 | 05.00 min | 50.00 |
781222 | 06.00 min | 60.00 |
781222 | 07.00 min | 70.00 |
==============================

from the above data, after doing separation and calculation i want an output file with the following data;

==============================
Field1 | Field2 | Field3|
==============================
771323 | 02.00 min | 30.00 |
771323 | 04.00 min | 40.00 |
771323 | 05.00 min | 50.00 |
771323 | 06.00 min | 60.00 |
771323 | 07.00 min | 70.00 |
----------------------------
Total $ 250 $

829999 | 02.00 min | 30.00 |
829999 | 04.00 min | 40.00 |
----------------------------
Total $ 70 $

781222 | 05.00 min | 50.00 |
781222 | 06.00 min | 60.00 |
781222 | 07.00 min | 70.00 |
----------------------------
Total $ 180 $
==============================

it was difficult for me to explain this in written, i hope you could understand this and explain me how i can proceed.

chao, xtravel
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com