I have file which has log size like,
10.80 kb
60.08 kb
35.40 kb
2.20 MB
1.10 MB
40.80 kb
3.15 MB
20.50 kb
I want to add awk one liner in such a way that it satisfy below conditions,
- Convert kb to MB (divide by 1000)
- get total in MB
I have written below awk code but it fails to add MB,
awk '{FS=" "} if ($2 ~ 'kb'){total += ($1/1000)}END{print total}'
This will convert kb's into MB and provide total but it does not add MB values to it. Please suggest?