can somebody please help to format a text file

can somebody suggest or comment how to build the algorithm cause I'm really stucked.

GEO,POPR R MC52 ,POPRNI S 2
082,MC,
0.000 9
-4.700 386.383 -3.690 386.363 -3.650 386.363 -3.500 386.332
0.000 386.420 3.500 386.333 3.650 386.363 3.690 386.363
4.700 386.383
10.000 9
-4.764 386.466 -3.754 386.446 -3.714 386.446 -3.564 386.416
0.000 386.505 3.500 386.417 3.650 386.447 3.690 386.447
4.700 386.468
20.000 9
-5.098 386.543 -4.087 386.523 -4.047 386.523 -3.897 386.493
0.000 386.590 3.589 386.500 3.739 386.530 3.779 386.530
4.790 386.551
30.000 9
-5.445 386.619 -4.434 386.599 -4.394 386.599 -4.244 386.569
0.000 386.675 4.062 386.573 4.213 386.604 4.253 386.604
5.265 386.624
40.000 9
-5.702 386.693 -4.692 386.673 -4.652 386.673 -4.502 386.643
0.000 386.755 4.945 386.632 5.096 386.662 5.137 386.662
6.152 386.682
50.000 14
-5.818 386.763 -4.808 386.743 -4.768 386.743 -4.618 386.713
0.000 386.825 0.030 386.975 0.200 386.975 2.024 386.939
2.196 386.939 2.226 386.789 6.246 386.731 6.398 386.761
6.438 386.761 7.459 386.784
60.000 15
-7.237 386.797 -6.152 386.778 -6.109 386.778 -5.947 386.748
-1.181 386.859 -1.150 387.009 -0.974 387.009 0.000 386.886
3.711 387.048 3.884 387.049 3.915 386.899 7.975 386.922
8.128 386.952 8.169 386.952 9.196 386.977
999999.999



this is the text. and i need to get lines starting from 0.000


the last text should be like
1 1 .000 MODEL
0 -4.7000000 386.3830000
0 -3.6900000 386.3630000
0 -3.6500000 386.3630000
0 -3.5000000 386.3320000
0 .0000000 386.4200000
0 3.5000000 386.3330000
0 3.6500000 386.3630000
0 3.6900000 386.3630000
0 4.7000000 386.3830000
1 2 10.000 MODEL
0 -4.7640000 386.4660000
0 -3.7540000 386.4460000
0 -3.7140000 386.4460000
0 -3.5640000 386.4160000
0 .0000000 386.5050000
0 3.5000000 386.4170000
0 3.6500000 386.4470000
0 3.6900000 386.4470000
0 4.7000000 386.4680000
1 3 20.000 MODEL
0 -5.0980000 386.5430000
0 -4.0870000 386.5230000
0 -4.0470000 386.5230000
0 -3.8970000 386.4930000
0 .0000000 386.5900000
0 3.5890000 386.5000000
0 3.7390000 386.5300000
0 3.7790000 386.5300000
0 4.7900000 386.5510000
1 4 30.000 MODEL
0 -5.4450000 386.6190000
0 -4.4340000 386.5990000
0 -4.3940000 386.5990000
0 -4.2440000 386.5690000
0 .0000000 386.6750000
0 4.0620000 386.5730000
0 4.2130000 386.6040000
0 4.2530000 386.6040000
0 5.2650000 386.6240000
1 5 40.000 MODEL
0 -5.7020000 386.6930000
0 -4.6920000 386.6730000
0 -4.6520000 386.6730000
0 -4.5020000 386.6430000
0 .0000000 386.7550000
0 4.9450000 386.6320000
0 5.0960000 386.6620000
0 5.1370000 386.6620000
0 6.1520000 386.6820000
1 6 50.000 MODEL
0 -5.8180000 386.7630000
0 -4.8080000 386.7430000
0 -4.7680000 386.7430000
0 -4.6180000 386.7130000
0 .0000000 386.8250000
0 .0300000 386.9750000
0 .2000000 386.9750000
0 2.0240000 386.9390000
0 2.1960000 386.9390000
0 2.2260000 386.7890000
0 6.2460000 386.7310000
0 6.3980000 386.7610000
0 6.4380000 386.7610000
0 7.4590000 386.7840000
1 7 60.000 MODEL
0 -7.2370000 386.7970000
0 -6.1520000 386.7780000
0 -6.1090000 386.7780000
0 -5.9470000 386.7480000
0 -1.1810000 386.8590000
0 -1.1500000 387.0090000
0 -.9740000 387.0090000
0 .0000000 386.8860000
0 3.7110000 387.0480000
0 3.8840000 387.0490000
0 3.9150000 386.8990000
0 7.9750000 386.9220000
0 8.1280000 386.9520000
0 8.1690000 386.9520000
0 9.1960000 386.9770000

can somebody please tell me the first steps.
Thank you.
Sometimes for certain problems, we might want to think of other easier language for data manipulation. Usually for large input data with space, decimal etc, parsing them using C++ is hard enough. I would switch to Perl gladly. That is if you are open to the idea of using other language to solve your problem.
Is perl easy to learn?
You can write code faster in Perl and it's pretty easy to grasp the basics if you have an idea about programming. Then you just to learn regex and you can do whatever you want with text easily.
Last edited on
Topic archived. No new replies allowed.