Ask your own question, for FREE!
Computer Science 14 Online
OpenStudy (wolfe8):

Need help with awk commands. How to increase precision.

OpenStudy (wolfe8):

I have a file with 8 columns. I need to total up every row in columns 4 and 7. An example of a line in my file is: http://prntscr.com/3la298 When I awk it, I get http://prntscr.com/3la311 As you can see it doesn't read the values properly and stops at a few figures. How do I make it read everything in the column? Here is my awk file http://prntscr.com/3la4hg

OpenStudy (rsmith6559):

END { printf( "%.8f, %.8f, %.8f\n", totalx, totalpsi, h ) }

OpenStudy (wolfe8):

Thanks! I'll try that tomorrow when I go back to work.

OpenStudy (wolfe8):

One question, would that just print it with lots of decimal places? Because when I run it for the whole data file it just adds the 'shortened' values.

OpenStudy (wolfe8):

Sadly that did not work. I did figure out the source of the problem though. Awk can only read exponents in the form of e and not D. I changed that in my data file and awk runs fine now. Thanks for trying.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
2 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!