SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
File reads

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
File reads
Author Message
Jeremy



Joined: 06 Dec 2000
Posts: 17

Post File reads Reply with quote

Is there a simple way to read in just the last line of a file? The situation is a log file which contains approx 60 lines of data and I need to put the last line into a string variable in order to perform some actions based on data pulled using a GetToken on the string.

Wed Jun 20, 2001 2:50 pm View user's profile Send private message
Jeremy



Joined: 06 Dec 2000
Posts: 17

Post Re: File reads Reply with quote

Also, this has to be done without looping through the entire file. That's what I'm doing currently and it is taking too long when working with about 1600 files. Thanks!

: Is there a simple way to read in just the last line of a file? The situation
: is a log file which contains approx 60 lines of data and I need to put the
: last line into a string variable in order to perform some actions based on
: data pulled using a GetToken on the string.

Wed Jun 20, 2001 2:52 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: File reads Reply with quote

Is the line lenght fixed?

: Also, this has to be done without looping through the entire file. That's
: what I'm doing currently and it is taking too long when working with about
: 1600 files. Thanks!

Wed Jun 20, 2001 3:21 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: File reads Reply with quote

Try using FileCompare to compare your file against an empty file. This will give you the number of "new" lines, then you can use FileReadLine to read the last line only (internally it does the same read loop, but it should do it many times faster than in JAL).

: Is there a simple way to read in just the last line of a file? The situation
: is a log file which contains approx 60 lines of data and I need to put the
: last line into a string variable in order to perform some actions based on
: data pulled using a GetToken on the string.

Wed Jun 20, 2001 3:26 pm View user's profile Send private message
Jeremy



Joined: 06 Dec 2000
Posts: 17

Post Re: File reads Reply with quote

: Is the line lenght fixed?

No, it's variable. The data in the log file is based of a filtered dump of the NT application log and contains a variable number of lines and number of characters per line. As it is, I'm looping through the file with filereads until I get to the EOF, then I use GetToken on the last string to separate the line into the variables I need.



Wed Jun 20, 2001 3:28 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: File reads Reply with quote

Then please see my second post in this thread

: No, it's variable. The data in the log file is based of a filtered dump of
: the NT application log and contains a variable number of lines and number
: of characters per line. As it is, I'm looping through the file with
: filereads until I get to the EOF, then I use GetToken on the last string
: to separate the line into the variables I need.

Wed Jun 20, 2001 4:37 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.