Df -h help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Df -h help
# 1  
Old 07-27-2018
Df -h help

Hi friends

I am writing to below for getting disk usage details

Code:
df -h / | awk '/\// {printf \$2","\$3","}'

It showing correctly, but I need without unit of measure

for example if its 240G --> I need to get only as 240

and
if at it all disk size is 0 then it should return as null or 0

Can you kindly suggest


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 07-27-2018 at 07:50 AM.. Reason: Added CODE tags (AGAIN!).
# 2  
Old 07-27-2018
Try

Code:
df -h / | awk ' {printf "%s, %s\n" , $2+0, $3+0}'

and also start to use printf's format string correctly.
The second question I do not understand - what else could it display?
This User Gave Thanks to RudiC For This Post:
# 3  
Old 07-27-2018
Thank you very much... Smilie
Second question is if disk space is zero, then it should display as NULL what i mean...

Anyway thank you

Last edited by onenessboy; 07-27-2018 at 08:22 AM.. Reason: change
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question