Re: find last entry in a file

2003-02-20 Thread John W. Krahn
David wrote: > > Joseph Paish wrote: > > > i have a data file that looks something like this : > > ( it is already sorted by date ) > > > > 12/22/02 abc 123 456 789 > > 12/23/02 def 246 812 98234 > > 12/24/02 ank 987 23456 8762 > > 12/27/02 abc 987 345 65434 > > 01/05/03 abc 876 2356 87 > > 01/09

Re: find last entry in a file

2003-02-20 Thread david
Joseph Paish wrote: > i have a data file that looks something like this : > ( it is already sorted by date ) > > 12/22/02 abc 123 456 789 > 12/23/02 def 246 812 98234 > 12/24/02 ank 987 23456 8762 > 12/27/02 abc 987 345 65434 > 01/05/03 abc 876 2356 87 > 01/09/03 ank 875 234 98098 > 02/01/03 def

RE: find last entry in a file

2003-02-20 Thread Paul
That makes me happy. :) split() was my first thought, but I wanted to keep it simple for the example(for once), and thought it might actually be faster. Personally, though, I'd *definitely* use the split()! --- "NYIMI Jose (BMB)" <[EMAIL PROTECTED]> wrote: > > my $prevrec = <>; > > my $key =

RE: find last entry in a file

2003-02-20 Thread NYIMI Jose (BMB)
> my $prevrec = <>; > my $key = substr($prevrec,9,3); I'd be using split here to avoid hard-coding the string's length my $key=( split(/\s+/,$prevrec) )[1]; > while(<>) { > my $tmp = substr($_,9,3); The same here ... my $tmp=( split/\s+/ )[1]; > next if $key eq $tmp; > print $

Re: find last entry in a file

2003-02-20 Thread Paul
--- Joseph Paish <[EMAIL PROTECTED]> wrote: > i have a data file that looks something like this : > ( it is already sorted by date ) > 12/22/02 abc 123 456 789 > 12/23/02 def 246 812 98234 > 12/24/02 ank 987 23456 8762 > 12/27/02 abc 987 345 65434 > 01/05/03 abc 876 2356 87 > 01/09/03 ank 875 234

RE: find last entry in a file

2003-02-20 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Joseph Paish wrote: > i have a data file that looks something like this : > ( it is already sorted by date ) > > 12/22/02 abc 123 456 789 > 12/23/02 def 246 812 98234 > 12/24/02 ank 987 23456 8762 > 12/27/02 abc 987 345 65434 > 01/05/03 abc 876 2356 87 > 01/09/03 ank 875 234 98098 > 02/01/03 def 9

find last entry in a file

2003-02-20 Thread Joseph Paish
i have a data file that looks something like this : ( it is already sorted by date ) 12/22/02 abc 123 456 789 12/23/02 def 246 812 98234 12/24/02 ank 987 23456 8762 12/27/02 abc 987 345 65434 01/05/03 abc 876 2356 87 01/09/03 ank 875 234 98098 02/01/03 def 987 3453 456 02/05/03 ghi.th 987 2345 94