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

Home » Public Forums » archive » Re: reading long files
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: reading long files [message #1442 is a reply to message #1431] Mon, 08 November 1993 02:51 Go to previous messageGo to previous message
knipp is currently offline  knipp
Messages: 68
Registered: January 1993
Member
In article 9nn@organpipe.uug.arizona.edu, rdc@helium.gas.uug.arizona.edu (richard d clark) writes:
>
> A previous post mentions a two pass method of reading the file first
> determining the necessary size of the array and then reading into it. For
> people running on unix systems spawning a 'wc' will accomplish the first
> pass faster than reading it with idl. Our wc returns # lines, # words, and
> # characters in the file so the array dimensions can be calculated by your
...
> Richard Clark
> rclark@lpl.arizona.edu (or the address in the header)
> For the 10,000th time: it's in Astronomical Algorithms by Jean Meeus!



Another way to count just the number of lines in a file (!UNDER UNIX)
is:

awk "END {print NR}" >filename<


Use SPAWN and capture the output in a variable.


A more general way is to count the number of carr.returns in the file:

CR_BYTE = 10b ; (p.e. for UNIX-Systems)

OPENR, UNIT, FILENAME, /GET_LUN
INFO = FSTAT(UNIT)
I = ASSOC(UNIT, BYTARR(INFO.SIZE))
POS = WHERE(I(0) EQ CR_BYTE)
FREE_LUN, UNIT

NOF_LINES = N_ELEMENTS(POS)


Karl




____________________________________________________________ __________________
__ ____ __
/ // _ \ / / Karlheinz Knipp phone: +49 511 - 762 4922
/ // /_/ // / University of Hannover fax: +49 511 - 762 2483
/ // ____// / Institute for Photogrammetry
/ // / / / Nienburger Str.1
/_//_/ /_/ FRG 30167 Hannover 1 email: knipp@ipi.uni-hannover.de
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: VMS input file line counting procedure
Next Topic: netCDF files in IDL?

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

Current Time: Fri Oct 10 09:32:43 PDT 2025

Total time taken to generate the page: 0.32175 seconds