It seems to be working, but in some line there are this 0 and -0 added at the front and back of some values. Please check the output file for reference
Thanks for all your effort for helping me out. I now face a problem with a differnt data structure. Where some part of my values contains many zeros and i need them to be arranged in a seperate zeros. such as
Thanks for your reply. Actually the problem is it's not possible to tell how many zeros. I am trying to automize the post processing based on the results genetrated by a CFD tool and in my future case there might be many hundres of zeros. If you could please check the outpout file U_z27 with input coming from U_z2. I used your code
sed -r 's/(-*[0-9]\.)/\n\1/g; s/(\.[0-9]{3})([0-9])/\1\n\2/g; s/\n//'
and got this output. The results looks fine but it is not arranging the zeros ( from line 2927 in the output file). I know that i might still not able to clarify your question. But if you could still help me. I will be glad.
Note: Files U_z2 and U_z27 are in my previous post
If there's no info, we need to base solutions on assumptions. This one assumes that there's no trailing zeroes in a value, i.e. a less than three decimal number ends witha meaningful digit, and that there's positive values to follow the zeroes' suite. Try
sed -r 's/(-*[0-9]\.)/\n\1/g; :L; s/([^\n])0\n/\1\n0\n/;tL; s/\n//' /tmp/U_z2.txt