Refine awk

Hi
The commnad shows the following o/p

df -kh /abc/bds/ |awk {'print$5'}
capacity
87%

I want the o/p as 87 only
Can we achieve this using a oneliner of sorts

NB : Code tags not working with my google chrome , So wasn't able to place code in tags . Pls dont penalise :slight_smile:

Thanks

df -kh /abc/bds/ | awk 'NR-1 {print $2 + 0 }'

gives o/p as
0
0

Any ideas !!!!

Sorry, I used $2, you wanted $5.

It should print only one line, not two, based on your df statement.

$ df -h /Volumes/share/ | awk 'NR-1 {print $5 + 0}'          
80

edit: Actually, in Linux (if that's what you're using) you might want to use the -P option to keep the output on one line

old awk will not work on Solaris use nawk or /usr/xpg4/bin/awk or gawk on Linux

Thnak all

Could you pls tell how your command works..

df -h /Volumes/share/ | awk 'NR-1 {print $5 + 0}'