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

Home » Public Forums » archive » Re: How to read first and last line of an ascii file FAST
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to read first and last line of an ascii file FAST [message #72333] Sun, 29 August 2010 18:27 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Aug 29, 11:32 am, ahs <agna...@gmail.com> wrote:
> 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

What OS? On unix and Mac, I'd just spawn "tail -1 filename". No idea
if there's a Windows equivalent.

-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: about the blackbody radiation curve
Next Topic: Re: how to change button names on the dialog_message

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

Current Time: Wed Oct 08 17:56:15 PDT 2025

Total time taken to generate the page: 0.00423 seconds