[gradsusr] GRADS txt file, substr, looping
Luciano Ritter
nolascojr12 at hotmail.com
Wed Sep 14 13:47:55 EDT 2016
Hi
I am trying to read a data file in .txt and extract the information that I need.
I read the file trough the function 'read', but the problem is that i can't extract the information.
The format of the data is:
line1 = 83844;01/01/2000;1200;57.6;23.6;22.8;93;0;0;
line2 = 83844;01/01/2000;1800;;23.6;22.6;91;18;6.6;
line3 = 83844;02/01/2000;0000;;22;21.3;93;18;4.6;
line4 = 83844;02/01/2000;1200;51.4;23.2;21.7;87;18;3.3;
I need to extract only 23,6 ; 23,6 ; 22 ; 23,2 of the first, second, third and fourth lines. I was trying with the intrinsic function, for example to the first line:
var = substr(line1,28,4)
var = 23,6
If it was only those 4 lines, i could do manually but they are 10200 lines. So, I think i need some loop with 'while' variating the substr function, but i don't know how to do this.
Someone can help me?
Thanks a lot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20160914/c4463622/attachment.html
More information about the gradsusr
mailing list