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

Home » Public Forums » archive » Re: combining many files with the same format into one 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: combining many files with the same format into one file [message #46751] Thu, 22 December 2005 00:07 Go to previous message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
Good morning,

if you happen to use a Unix / Linux computer, I'd suggest not to use
IDL at all for this purpose but rather do something like

$ cat file1 file2 ... file50 > combined_file

Assuming that the files "file1" to "file50" are your ascii files, with
this command you will end up with one file, named "combined_file" which
is nothing but the desired concatenation. Now, it is a bit tedious to
manually type in 50 filenames, so if again you are lucky and all your
files follow a unique naming convention, you can ease your life to
something like

$ cat file* > combined_file

which will do the same as the above line.

Now, if you really want to do this within IDL, you can get along with
the following lines:

f = file_search("file*", c)
line = ""
openw, out, "combines_file", /get_lun
for i = 0, c-1 do begin
openr, in, f[i], /get_lun
while not eof(in) do begin
readf, in, line
printf, out, line
endwhile
free_lun, in
endfor
free_lun, out


Cheers,

Peter
[Message index]
 
Read Message
Read Message
Previous Topic: Re: 2005 IDL Christmas Card
Next Topic: tutorials

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

Current Time: Sat Oct 11 01:13:53 PDT 2025

Total time taken to generate the page: 2.48026 seconds