mmittiga17 has asked for the wisdom of the Perl Monks concerning the following question:
Quick question:
I have CSV file containing account information. Each line contains has a unique account number and other information.
I need to parse the file for the last line for each unique account number. Sample data:account numbers=abc123 and xyz123 20080618,adfadf,adfadf,abc123,ljlkjll, 20080618,jfjfjf,bmbmbm,abc123,zzzdddd, 20080618,343434,959595,abc123,fjadfaf, <==parse 20080618,adfadf,adfadf,xyz123,ljlkjll, 20080618,adxxxf,gggsss,xyz123,ggaaddf, 20080618,dddfff,dfdfdd,xyz123,xxxxxd, <==parse
So what I need is a way to iterate through each line of the file and for each unique account number print out the last line containing the unique account number.
So for accont xyz123, I would want to the last line for that account.Any suggestion or idea on how to accomplish this, will be appreciated20080618,adfadf,adfadf,xyz123,ljlkjll, 20080618,adxxxf,gggsss,xyz123,ggaaddf, 20080618,dddfff,dfdfdd,xyz123,xxxxxd, <==parse
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parse file question
by poolpi (Hermit) on Jun 23, 2008 at 10:14 UTC | |
|
Re: Parse file question
by psini (Deacon) on Jun 23, 2008 at 09:55 UTC | |
|
Re: Parse file question
by Anonymous Monk on Jun 23, 2008 at 09:38 UTC | |
|
Re: Parse file question
by waldner (Beadle) on Jun 23, 2008 at 11:23 UTC | |
|
Re: Parse file question
by Anonymous Monk on Jun 23, 2008 at 09:35 UTC |