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

Home » Public Forums » archive » Re: Fast editing of text file?
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: Fast editing of text file? [message #44476 is a reply to message #44472] Wed, 15 June 2005 20:28 Go to previous messageGo to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
andrew.cool@dsto.defence.gov.au wrote:
>
> If lines[0:10] and lines[12:*] don't change, why not hold those
> permanently
> in memory as two string arrays, array_top and array_bottom.
>
> Concoct Line 12 with your 3 new numbers,
> and then printf to a new version of the file :-
>
> printf,outlun, array_top ; lines 1..11
> printf,outlun, line12 ; line 12
> printf,outlun, array_bottom ; lines 13..end of file
>
> This way you've only got 1 read, at the very start of your program, and
> then 1 write per change of numbers.

It might be that the concatenation of these three components could be
done more quickly by a system command like Unix "cat". In other words
you would have file_top and file_bottom containing the unchanging bits;
IDl would write a new version of file_middle each time, then

spawn, "cat file_top file_middle file_bottom > file"

On the other hand it could be slower...


--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How does IDL find functions?
Next Topic: ASCII read problem

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

Current Time: Sat Oct 11 06:28:06 PDT 2025

Total time taken to generate the page: 1.76280 seconds