comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to read first and last line of an ascii file FAST
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
How to read first and last line of an ascii file FAST [message #72336] Sun, 29 August 2010 08:32
agnarhs is currently offline  agnarhs
Messages: 4
Registered: May 2009
Junior Member
Hello group,

My data is stored in a bunch of ascii files, each 5-10MB big. Each
line represent a sample with a timestamp. I would like to analyse all
my files by reading the timestamp from the first and last line of
every file. Getting the timestamp from the last line is the issue
here. Right now I'm doing it like

readf, fid, firstline
nlines = FILE_LINES(fnames[i])
skip_lun, fid, nlines-2, /LINES
readf, fid, lastline

skip_lun is really slow when the files are big and numerous. Does
anyone have a tip of I could do this faster? Is there a way to
directly point to the end of the file minus one line?

regards,
Agnar
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: How to ensure arrays are de-allocated in IDL?
Next Topic: really dumb IDL8 IDLDE q...

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 09:22:28 PDT 2025

Total time taken to generate the page: 2.11829 seconds