Tag Archives: linux news

Awk Floating Point Number Addition Results Are Unexpected

I am using awk to grep ‘foo’ from a text file and cacluate sum of field # 7. But, result is rounded to an integer. I need exact result such as 385858.66 and not 385858 using the following command:

grep ‘foo’ 2012-2013.txt | awk ‘BEGIN{ sum=0.0}{ sub(“,”,””,$7); sum +=$7}END{ print “$” sum}’ $682444

I want $682444.57 as output. How can I force “awk” to do floating point math?

Read answer to: “Awk Floating Point Number Addition Results Are Unexpected

Tweet this    Share on Facebook

Powered by WPeMatico

Linux: Find Out How Much Disk Space Left On Hard Drive

I am a desktop support professional with experience working in a corporate call center environment. Recently, I started to admin RHEL based IBM Linux server. How do I determine how much disk space left in my Linux server? How do I find out how much disk space I have in Linux for each partition?

Read answer to: “Linux: Find Out How Much Disk Space Left On Hard Drive

Tweet this    Share on Facebook

Powered by WPeMatico