Hi all, I have a problem in sorting a fortran data and I don't know fortran. Its quite big data and its not in column arrangement. the sample is below :

3.900000000E 2.180E 0.000E 2.653E 1.763E2.339E-01 0.000 0.6983 0.2814 0.0001 0.0080 0.0067 0.0019 0.0007 0.0000 -3.6431 1.4826 7.3919
7.476000000E 5.000E 0.000E 1.405E 3.831E-25 1.496E-01 0.000 0.6983 0.2814 0.0001 0.0080 0.0067 0.0019 0.0007 0.0000 -3.6431 1.4826 7.3919
-1.000000000E 6.000E-01 0.000E 1.473E 0.000E 1.496E-01 0.000 0.6985 0.2814 0.0035 0.0010 0.0101 0.0019 0.0007 1.0000-16.9609 -9.1006 4.1354
1.000000000E 0.000E 0.000E 0.000E 7.384E-07 0.000E 0.00000 0.000 0.874 3.900 3.900 3.900 3.900 -9.046 1.61923 0.3449 2.1845
1.370727360E7.113E 0.000E 0.000E 0.000E 1.220E-21 2.113 0.867 3.900 3.900 3.900 3.900 0.000 0.049 0.324 -0.141 -0.477

Those are 1 set of 88 different numbers and there are 663 different set. How can I sort these huge set of numbers into 88 column. I attached 1 page of the data if you guys out there kindly want to help me sort these numbers.

Thank you.

first of all I have a bad feeling about this. because the algorithm that I will
suggest will be not complete in the polynomial time.

So dataset like this , you need to scan for it. For that you can simply use
the regex libraries ( whatever supported in you're plactform ). and that's
the easy way , but it will take a long time.

The second option is use a lex like tool to generate the code for a
lexer to scan these numbers that contain different formats.
In windows environment this tool was named as flex.
http://gnuwin32.sourceforge.net/packages/flex.htm
is their project page. and google around , there are some examples
to do something like that , with auto generated scanner code.

but if you using the regex libraries instead, then I can't guarantee that algorithm will end up in the polynomial time.

best regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.