I have a file looking like this. But, if you look at second line, the number are stick together(e.g. 33.9918.913418.9570). What I want to do is to separate these number by white space. I tried to use tr below, but it doesn't work. Any help would be appreciated.
<Input>
7.23 7.32 5.21 10.13 5.06 5.06 0.2381 0.7772 0.6152
41.28 45.18 48.37 51.92 33.41 33.9918.913418.9570 1.1610
6.53 7.44 8.22 9.14 5.06 5.06 0.5788 0.5788 0.6050
The original format looks above no space between 33.99,18.9134, and 18.9570. That is the problem.
My goal is to add "space" between these values so that all values should be separated by space like this.
41.28 45.18 48.37 51.92 33.41 33.99 18.9134 18.9570 1.1610
>Could you please elaborate this ?
>How do you identify there should be a space only after 33.99 and 18.9134 ?
41.28 45.18 48.37 51.92 33.41 33.9918.913418.9570 1.1610
The original format looks above no space between 33.99,18.9134, and 18.9570. That is the problem.
My goal is to add "space" between these values so that all values should be separated by space like this.
41.28 45.18 48.37 51.92 33.41 33.99 18.9134 18.9570 1.1610
This is still not clear.
I can get the output.
But how do you transform it. Is there any logic for the grouping of numbers mentioned above ?
For example :
I could just split the above as
33.9 918.913 418.9570 something like that
Now I could see that there is a comma in the format posted just now and no such comma in the original file format
Let me try to clarify.
Input file has many lines.
7.23 7.32 5.21 10.13 5.06 5.06 0.2381 0.7772 0.6152
41.28 45.18 48.37 51.92 33.41 33.9918.913418.9570 1.1610
6.53 7.44 8.22 9.14 5.06 5.06 0.5788 0.5788 0.6050
31.38 25.17 18.37 41.92 13.41 31.2017.211218.2870 7.1710
21.28 35.15 28.37 21.92 3.41 23.9216.817619.4525 2.3615
...
...
but all values should be separated by spaces.
As you can see, column 7,8, and 9 can not be separated in line 2, 4, and 5 because all numbers are stick together without space.
The reason is that the precision of the first 6 values are two decimal points after period, while that of last 3 values are four decimal points after period.
Such high precision of the last 3 values are used up the space separator between values.
As you said, there should be a space only after 33.99 and 18.9134 in second line, 31.20 and 17.2112 in 4th line, 23.92 and 16.8176 in 5th line..and so on.
Hope this is help for better understanding.
Thanks,