Hi,
I am trying to get the rounded number of the average load in the past 5 mins. So here goes my command:
uptime | awk -F, '{print $5}'|printf "%.0f\n"
It seems incorrect as it always give me 0.
If I tried to use a variable as intermediate between awk and printf, then it is correct
avgload=$(uptime | awk -F, '{print $5}')
printf "%.0f\n" $avgload
So anything wrong with my first try?
Thanks and regards!
UPDATE:
Just for getting the average load in the past 5 mins, here is the output of uptime on my linux server (Kubuntu)
$ uptime
13:52:19 up 29 days, 18 min, 15 users, load average: 10.02, 10.04, 9.58
On my laptop (Ubuntu) it is similar
`$ uptime
13:53:58 up 3 days, 12:02, 8 users, load average: 0.29, 0.48, 0.60 `
That's why I take the 5th field.