sandeepmur
Programmer
Hi,
A df -k cmd in my HPUX machine gives the output :
/home/etbc01/KISS-EAI-R1 (/dev/VG_tbc/tibco_uat ) : 35510664 total allocated Kb
13786728 free allocated Kb
21723936 used allocated Kb
61 % allocation used
I need to obtain the value "61 %" from the above.. I have a script that obtains the free space.. can anyone please modify it for me ? here goes:
#!/usr/bin/sh
if (test $# -eq 0); then
df -k | awk '/\/home / || /\/opt /{
dir=$1;
getline;
free=$1;
print dir" "free
}'
else
df -k | awk '$1=="/"check {
dir=$1;
getline;
free=$1;
print free;
flag="true";
} END {
if (flag=="false") print -1
}' check="$1" flag="false"
fi
A df -k cmd in my HPUX machine gives the output :
/home/etbc01/KISS-EAI-R1 (/dev/VG_tbc/tibco_uat ) : 35510664 total allocated Kb
13786728 free allocated Kb
21723936 used allocated Kb
61 % allocation used
I need to obtain the value "61 %" from the above.. I have a script that obtains the free space.. can anyone please modify it for me ? here goes:
#!/usr/bin/sh
if (test $# -eq 0); then
df -k | awk '/\/home / || /\/opt /{
dir=$1;
getline;
free=$1;
print dir" "free
}'
else
df -k | awk '$1=="/"check {
dir=$1;
getline;
free=$1;
print free;
flag="true";
} END {
if (flag=="false") print -1
}' check="$1" flag="false"
fi