Re: Removing duplicate records

2007-08-02 Thread Chas Owens
On 8/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: snip > The code was tested. and it compiles for mee snip I serious doubt that the code you sent in the email was the code you tested then. You cannot, in any version of Perl that I know, declare an old style file handle with the my subr

Re: Removing duplicate records

2007-08-01 Thread John W. Krahn
Mr. Shawn H. Corey wrote: John W. Krahn wrote: Mihir Kamdar wrote: I want to remove duplicate records. But the record might not be entirely duplicate. I only have to check if the 2nd, 3rd, 7th and 8th field of a record is same as the earlier records. If it is same, then remove the previous or t

Re: Removing duplicate records

2007-08-01 Thread Mr. Shawn H. Corey
John W. Krahn wrote: Mihir Kamdar wrote: I want to remove duplicate records. But the record might not be entirely duplicate. I only have to check if the 2nd, 3rd, 7th and 8th field of a record is same as the earlier records. If it is same, then remove the previous or the last entry. I have writt

Re: Removing duplicate records

2007-08-01 Thread John W. Krahn
Mihir Kamdar wrote: Hi, Hello, Need your help with the following:- I have a csv file having many records. I want to remove duplicate records. But the record might not be entirely duplicate. I only have to check if the 2nd, 3rd, 7th and 8th field of a record is same as the earlier records. I

Re: Removing duplicate records

2007-08-01 Thread Rob Dixon
[EMAIL PROTECTED] wrote: Hi, The code was tested. and it compiles for mee What version of Perl are you using that accepts this? open my F, '>outputsample1' or die 'Failed to open outputsample1'; Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PR

Re: Removing duplicate records

2007-08-01 Thread Mihir Kamdar
ssage - > From: "Rob Dixon" <[EMAIL PROTECTED]> > To: beginners@perl.org > Sent: Wednesday, August 1, 2007 2:23:44 PM (GMT+0200) Auto-Detected > Subject: Re: Removing duplicate records > > [EMAIL PROTECTED] wrote: > > > > Small correction >

Re: Removing duplicate records

2007-08-01 Thread yaron
Hi, The code was tested. and it compiles for mee Yaron - Original Message - From: "Rob Dixon" <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Wednesday, August 1, 2007 2:23:44 PM (GMT+0200) Auto-Detected Subject: Re: Removing duplicate records [EMAIL PROTECTED]

Re: Removing duplicate records

2007-08-01 Thread Mr. Shawn H. Corey
Mihir Kamdar wrote: But the output I get is not comma seperated but space seperated:- Change this line: $hash{$cdr[2],$cdr[3],$cdr[6],$cdr[7]}="@cdr"; #Add some more cdr key fields if u want. To: $hash{$cdr[2],$cdr[3],$cdr[6],$cdr[7]}=$line; #Add some more cdr key fields if u want. -- J

Re: Removing duplicate records

2007-08-01 Thread Mr. Shawn H. Corey
Mihir Kamdar wrote: But I am not getting the desired result. What are the desired results? How is your output different from what you expect? -- Just my 0.0002 million dollars worth, Shawn "For the things we have to learn before we can do them, we learn by doing them." Aristotle --

Re: Removing duplicate records

2007-08-01 Thread Mihir Kamdar
Hi, The result is ok, but one big problem. My input file is a csv file. Its records are like: 2007/02/26 09:38:03,999,+60320840888,+60123773138,,1,5,2007/02/26 09:37:582,1,0,7,1,3,1,,0,4,+60320840888,,BRT70607,NOKIA_160_ISDN,,KL,KL 2007/02/26 09:38:05,999,+6032084,+60326931722,,1,21,2007/0

Re: Removing duplicate records

2007-08-01 Thread yaron
Hi, Your You did not open the output file correctly. You try to store the File handler in a variable. If you wish to do so open the file and store reference to the file handle. Instead of using open my $f, '>', 'outputsample1' or die 'Failed to open outputsample1'; while (($key, $value)

Re: Removing duplicate records

2007-08-01 Thread Rob Dixon
[EMAIL PROTECTED] wrote: Small correction Try open my F, '>outputsample1' or die 'Failed to open outputsample1'; my $f = \*F; while (($key, $value) = each %hash) { print $f $value."\n"; } close $f; Yaron. It would help if you tested your code before you published it. T

Re: Removing duplicate records

2007-08-01 Thread yaron
ECTED] To: "Mihir Kamdar" <[EMAIL PROTECTED]> Cc: "beginners" Sent: Wednesday, August 1, 2007 2:02:29 PM (GMT+0200) Auto-Detected Subject: Re: Removing duplicate records Hi, Your You did not open the output file correctly. You try to store the File handler in a varia