Hi Callahan
Did you thought on using head and tail for that e.g.
head n -100 file > newfile
or you can use a simple idl program
which does read partial a whole array of e.g.
tmp = make_array(28,100,/long)
openr,lun1,file,/get_lun
for i = 0,1 do begin
readf,lun1,tmp
openw,lun2,file+strtrim(i,2),transpose(tmp),/get_lun,width=2 8*12
printf,lun2,tmp
free_lun,lun2
endfor
free_lun,lun1
cheers
Reimar
DirtyHarry wrote:
> Last week I posted a question with almost same topic. I would like to
> slice a big file into several accoding to one of its row. I found
> there is some 'delimiter' problem that I cannot solve at this point.
> So I deleted them through making another simple IDL code and made a
> new data file, but still I got stuck in cutting it down.
>
> This is a part of my data file.
> file: 'HumNWS1.txt' (data(28, 164094))
>
> 90 2000 1 1 95 95 95 95 95 96 95 95 94 93
> 93 93 94 94 94 95 95 93 91 90 94 95 96 95
> 90 2000 1 2 96 95 94 96 93 93 76 74 76 81
> 85 84 76 53 43 40 39 41 33 33 32 32 33 35
> 90 2000 1 3 35 34 38 35 29 28 30 29 26 23
> 25 22 22 30 29 24 23 24 36 31 34 39 31 34
> .
> .
> .
>
>
> To divide this, I set up a source code like this...
>
>
> ------------------------------------
> pro hum_year
>
> ;
> ************************************************************ ***********************
>
> ; 1. Read file and set the initial value of variables and arrays.
> file = 'HumNWS1.txt'
> ndata=file_lines(file)
> data=intarr(28, ndata)
>
> close, /all
>
> ; 2. Prepare for new text files.
> openw,1,'HuNWS_2000.txt'
> openw,2,'HuNWS_2001.txt'
> openw,3,'HuNWS_2002.txt'
> openw,4,'HuNWS_2003.txt'
> openw,5,'HuNWS_2004.txt'
> openw,6,'HuNWS_2005.txt'
>
>
> ; 3. Read data and write them on the desgnated files.
>
> for t=0L,ndata-1 do begin
> case data(1L,t) of
> 2000:printf,1,format='(28i6)' , data[*,t]
> 2001:printf,2,format='(28i6)' , data[*,t]
> 2002:printf,3,format='(28i6)' , data[*,t]
> 2003:printf,4,format='(28i6)' , data[*,t]
> 2004:printf,5,format='(28i6)' , data[*,t]
> 2005:printf,6,format='(28i6)' , data[*,t]
> else:
> endcase
> endfor
>
> ; 4. close all files.
> close, /all
>
> print, 'Process is done!'
>
> end
> ----------------------------
> There was no problem in compiling. When I ran this file after
> compilation, there were no error messages, either. However, after I
> checked those new files (i.e. 'HuNWS_2000.txt'), I found there were no
> data in there... I don't understand why this happens. What's wrong in
> my case statement... ? Please give me some suggestions... thanks.
>
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
============================================================ =======
|