Results 1 to 3 of 3
Hello guys
I need to find a way to modify my file so I have my first number with 3 decimal points, comma, space and then my second number 3 ...
- 09-21-2011 #1Just Joined!
- Join Date
- Oct 2008
- Posts
- 4
Decimal points
Hello guys
I need to find a way to modify my file so I have my first number with 3 decimal points, comma, space and then my second number 3 decimal points too.
This is an example of my file:
12,10.026
8,6.35
5,5.83
11,7.87
And I need this output:
12.000, 10.026
8.000, 6.350
5.000, 5.830
11.000, 7.870
I think I can use something like: printf "%0.3f\n"
but how can I create a script that can read the whole file and save it in the output format I need?
Thanks a lot for your help
- 09-21-2011 #2Just Joined!
- Join Date
- Aug 2011
- Posts
- 48
You could use awk.
awk -F\, {printf("%.3f, %.3f\n",$1,$2)}' yourfile
- 09-21-2011 #3Just Joined!
- Join Date
- Oct 2008
- Posts
- 4
That works great!
Thanks a lot!!


Reply With Quote