I have a data file I need to edit it is in the form:
As you can the numbers have no spaces and I would like to edit the file in a very specific manner (I will be using it as an input file for simulation work). I would like the file to look like:
-1.0000000000000001e-001 0.0000000000000000e+000 0.0000000000000000e+000 4.3052618410549812e+009 0.0000000000000000e+000 0.0000000000000000e+000 2.4853118072193338e-015 2.4106903033391415e-004 4.3586744793222273e-005 4.5561759893187341e-005 -4.0315591956328645e+007 -9.1758824977759705e+003 -2.5181138417225957e+004 2.4853118072193338e-015
I have developed an algorithm to do such an edit and tried it in Notepad++ but, the programs adds "invisible" characters to the file which makes it invalid for my simulation. Here is the algorithm:
find string "-1." and replace with string " -1." (there is one space in front of the negative sign in the replacement)
Repeat step 1 for numbers 2-9.
find string "1." and replace with string " 1." (there are two spaces in front of the 1 in the replacement)
Repeat step 3 for numbers 2-9.
find string "- 1." and replace with "-1." (there are two spaces between the negative sign and 1 in the find string)
Repeat step 5 for numbers 2-9.
I want to do this in a UNIX shell (I am using macbook terminal) as I believe this will not add invisible characters and corrupt my data. Any help guys?
Thanks in advance!!!!!