Dear R-users,

I would like to know how could I read a file with different lines lengths.
I need read this file and create an output to feed my database.
So after reading I'll need create an output like this

"INSERT INTO TEMP (DATA,STATION,VAR1,VAR2) VALUES (20100910,837460, 39,390)"

I mean,  each line should be read. But I don`t how to do this when these
lines have different lengths

I really appreciate any help.

Thanks.



====Below the file that should be read ===========


*2010 10 01 00
83746  -43.25 -22.81      6  51*
1012.0  -9999    320     1.5   299.1   294.4 64
 1000.0    114    250     4.1   298.4   294.8 32
  925.0    797      0     0.0   293.6   292.9 32
  850.0   1524    195     3.1   289.6   288.9 32
  700.0   3156    290    11.3   280.1   280.1 32
  500.0   5870    280    20.1   266.1   260.1 32
  400.0   7570    265    23.7   256.6   222.7 32
  300.0   9670    265    28.8   240.2   218.2 32
  250.0  10920    280    27.3   230.2   220.2 32
  200.0  12390    260    32.4   218.7   206.7 32
  176.0  -9999    255    37.6 -9999.0 -9999.0  8
  150.0  14180    245    35.5   205.1   196.1 32
  100.0  16560    300    17.0   195.2   186.2 32
*2010 10 01 00
83768  -51.13 -23.33    569  41
* 1000.0     79  -9999 -9999.0 -9999.0 -9999.0 32
  946.0  -9999    270     1.0   295.8   292.1 64
  925.0    763     15     2.1   296.4   290.4 32
  850.0   1497    175     3.6   290.8   288.4 32
  700.0   3140    295     9.8   282.9   278.6 32
  500.0   5840    285    23.7   267.1   232.1 32
  400.0   7550    255    35.5   255.4   231.4 32
  300.0   9640    265    37.0   242.2   216.2 32


Best Regards,

-- 
Abraço,
Nilza Barros

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to