Thanks Steve and Raman Found a better alternative. Python. :)

import csv

ifileR25 = open('Report_2_5, "rb")

readerR25 = csv.reader(ifileR25)

rownum = 0
for row in readerR25:
 if rownum == 0:
 header = row
 else:
 colnum = 0
 for col in row:
 if rownum > 1:
 if colnum == 0:

<< do all my processing here >>
 
 colnum += 1
 
 rownum += 1

ifileR25.close()

The trouble's different. How do i open two files, the Report_2_5 above and also 
another one with the Customer IDs alone and look for rows only for in 
Report_2_5 for it and process them alone

for example,

Report_2_5 has the following data
C_ID, ID_NO, stat1, vol2, amount3
2134, Ins1, 10000, 20000, 10
2112, Ins3, 30000, 20000, 10
2121, Ins3, 30000, 20000, 10
2145, Ins2, 15000, 10000, 5
2245, Ins2, 15000, 10000, 5
0987, Ins1, 10000, 20000, 10

Now my customer id has the following records ONLY
2134
0987

Should i iterate through the complete customer id file to find out if a number 
is there ? if so, how do i create a report of just the following and process it 
?
C_ID, ID_NO, stat1, vol2, amount3

2134, Ins1, 10000, 20000, 10

0987, Ins1, 10000, 20000, 10


My output has to state

Stat1 : 20000
vol2 : 40000
amount3 : 20

Thanks in advance
Siva

On Tue, 03 Nov 2009 16:04:24 +0530  wrote
>Hi,
>
>On 11/03/2009 02:50 PM, Siva Subramanian wrote:
>> Hello,
>>
>> I am into my 1st BSc Statistics and into a project for an MNC. I am
>> trying my first hand at linux and was recently introduced to gawk.
>>
>
>Welcome to linux ! I hope your experience is pleasant and you're here to 
stay :)
>
>> I am having trouble processing a statistical dump that is provided to 
us in the
>> form of a csv file. The format of the file is given below
>> [...snip...]
>> We are extensively using
>> MS-Access for this and it has been a pain. A friend suggested that I 
try my
>> hand at using tools in linux.
>>
>
>Could you possibly show how far you've been able to get with awk to do this 
?
>
>If you haven't yet started, this should give you an idea:
>
>$ echo "C_ID, ID_NO, stat1, vol2, amount3" | awk -F ',' '{print $1 $2;}'
>
>...basically, break the problem down, try solving these smaller problems 
and 
>come back here when/if you get stuck.
>
>Not many people here are going to jump in and help out by giving you the 
>complete solution. People like helping out as long as they don't feel like 
>they're being suckered into doing somebody's work.
>
>Moreover, solving such problems is fun on linux, because there are just so 
many 
>options of tools and ways get to the same solution. You'll miss out on it 
if we 
>just handed over a solution to you :).
>
>So, show some code and we'll help.
>
>> I am not sure if this is the
>> right mailing list for this.
>>
>Yes, it is. Everything from programming to pettifogging is tolerated on 
this 
>list as long as it is FOSS related and doesn't get out of hand :).
>
>
>cheers,
>- steve
>-- 
>random non tech spiel: http://lonetwin.blogspot.com/
>tech randomness: http://lonehacks.blogspot.com/
>what i'm stumbling into: http://lonetwin.stumbleupon.com/
>_______________________________________________
>To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with 
>"unsubscribe  "
>in the subject or body of the message. 
>http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
>
_______________________________________________
To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with 
"unsubscribe <password> <address>"
in the subject or body of the message.  
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to