- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2002 09:25 AM
10-24-2002 09:25 AM
the output of "df -k" is giving the following output.
/home (/dev/vg02/lvol2 ) : 17364312 total allocated Kb
2772080 free allocated Kb
14592232 used allocated Kb
84 % allocation used
/usr (/dev/vg00/lvol7 ) : 1471160 total allocated Kb
1034935 free allocated Kb
436225 used allocated Kb
29 % allocation used
I want as followes.
/home /usr
84 % 29 %
can some body suggest the shell script?
the script must use 'df' command ( not 'bdf').
Thnx in advance.
VB
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2002 09:48 AM
10-24-2002 09:48 AM
Re: shell script
Try the following but you may have to adjust the printf statements to cater for the maximum length filesystem name that you have (I have allowed only 10 chars...
#!/usr/bin/sh
let NUM=0
df -k | {
while read A B C
do
if [[ ${A} = /*(?) ]];
then MP[NUM]=${A}
continue
fi
if [[ ${B} = % ]];
then PCT[NUM]=${A}
let NUM=NUM+1
continue
fi
done
}
let TOTAL=NUM
let NUM=0
while ((NUM < TOTAL));
do
printf "%10s" ${MP[NUM]}
let NUM=NUM+1
done
let NUM=0
while ((NUM < TOTAL));
do
printf "%9s\%" ${PCT[NUM]}
let NUM=NUM+1
done
exit
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2002 10:16 AM
10-24-2002 10:16 AM
Solutionecho "/home /usr"
HOM=`df -k /home|grep %|awk '{print $1}'`
USR=`df -k /usr |grep %|awk '{print $1}'`
echo "$HOM % $USR %"
Sorry my first example was for /var and /usr. But now you can compare them both and see that there isn't much to make if work for any filesystem or any number of file systems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2002 10:17 AM
10-24-2002 10:17 AM
Re: shell script
echo "/var /usr"
VAR=`df -k /var|grep %|awk '{print $1}'`
USR=`df -k /usr |grep %|awk '{print $1}'`
echo "$VAR % $USR %"
This should work for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2002 06:16 AM
10-25-2002 06:16 AM
Re: shell script
bdf /home /usr
...Manjeet