View Single Post
 2007-11-29, 05:59 #2 Ken_g6     Jan 2005 Caught in a sieve 5×79 Posts Well, this chunk: Code: ' -- Read last number from file do s1 = ts.readline If Len(Trim(s1)) > 0 Then lastline = s1 End If loop until ts.atendofstream s2 = "" for i = 1 to len(lastline) ch = mid(lastline,i,1) if isnumeric (ch) then s2 = s2 & ch end if if not isnumeric(ch) and ch <> "," and len(s2) > 0 then exit for end if next ts.close start = s2 looks to be equivalent to: Code: start = tail -1 $logfilename | sed -e "s/^[^0-9,]*//;s/[^0-9,].*$//;s/,//g" Ain't regular expressions grand? Of course, with the amount of math done in other places, you might want to use a different scripting language instead. Might I suggest Perl, where I believe that line would work almost identically? In Perl: Code: $start = tail -1$logfilename; $start =~ s/^[^0-9,]*//;$start =~ s/[^0-9,].*$//;$start =~ s/,//g"; is even better, since sed (Perl's older brother) isn't used.