- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: bdf one line output
Operating System - HP-UX
1752402
Members
5619
Online
108788
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО09-07-2009 08:01 AM
тАО09-07-2009 08:01 AM
Hi Guys,
I have HP-UX 11.00 server. Below is the bdf output of it.
$ bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 1048576 41307 944370 4% /
/dev/vg00/lvol1 255253 74183 155544 32% /stand
/dev/vg00/lvol8 3145728 647245 2349665 22% /var
/dev/vg00/lvol7 1048576 561919 456264 55% /usr
/dev/vg00/lvpatrol 1024000 224406 749634 23% /usr/localcw/opt/patrol
/dev/vg00/lvol6 1572864 2057 1472672 0% /tmp
/dev/vg00/lvol5 1572864 898294 632427 59% /opt
/dev/vg00/lvol4 32768 3796 27186 12% /home
/dev/vg_glxy_02/obus_syb_fs
4104192 4750 3845593 0% /biller/obus_sybase
/dev/vg_glxy_02/obus_rep_fs
2052096 2281 1922348 0% /biller/obus_repserver
As you can see above, the last two FS of bdf comes in separate lines, but we run one script that need to have the one line output for every FS, and all fields of bdf are mandatory. That script is scheduled and run on many other servers also. I tried df -kp, but no use.
Is there anyway that we can get the one line output of every FS in bdf or any other command.
Thanks
I have HP-UX 11.00 server. Below is the bdf output of it.
$ bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 1048576 41307 944370 4% /
/dev/vg00/lvol1 255253 74183 155544 32% /stand
/dev/vg00/lvol8 3145728 647245 2349665 22% /var
/dev/vg00/lvol7 1048576 561919 456264 55% /usr
/dev/vg00/lvpatrol 1024000 224406 749634 23% /usr/localcw/opt/patrol
/dev/vg00/lvol6 1572864 2057 1472672 0% /tmp
/dev/vg00/lvol5 1572864 898294 632427 59% /opt
/dev/vg00/lvol4 32768 3796 27186 12% /home
/dev/vg_glxy_02/obus_syb_fs
4104192 4750 3845593 0% /biller/obus_sybase
/dev/vg_glxy_02/obus_rep_fs
2052096 2281 1922348 0% /biller/obus_repserver
As you can see above, the last two FS of bdf comes in separate lines, but we run one script that need to have the one line output for every FS, and all fields of bdf are mandatory. That script is scheduled and run on many other servers also. I tried df -kp, but no use.
Is there anyway that we can get the one line output of every FS in bdf or any other command.
Thanks
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-07-2009 08:06 AM
тАО09-07-2009 08:06 AM
Solution
Hi:
This question arises frequently.
You could use:
# bdf | awk '{if (NF==1) {line=$0;getline;sub(" *"," ");print line$0} else {print}}'
OR:
You could avail yourself of a richly functional script by Bill Hassell which accomodates your requirement and much, much more. Bill's most recent version (5.2) is attached at the end of this thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1326767
Regards!
...JRF...
This question arises frequently.
You could use:
# bdf | awk '{if (NF==1) {line=$0;getline;sub(" *"," ");print line$0} else {print}}'
OR:
You could avail yourself of a richly functional script by Bill Hassell which accomodates your requirement and much, much more. Bill's most recent version (5.2) is attached at the end of this thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1326767
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-07-2009 09:26 AM
тАО09-07-2009 09:26 AM
Re: bdf one line output
Hi,
The best utility is bdfmesg created by Greate Bill H.
I am attaching the script download and enjoy..and thanks to Bill.
Suraj
The best utility is bdfmesg created by Greate Bill H.
I am attaching the script download and enjoy..and thanks to Bill.
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-07-2009 12:31 PM
тАО09-07-2009 12:31 PM
Re: bdf one line output
Split lines from bdf are always a problem, but there is an easy scripting method to handle it. Basically, you read the first line then check the 2nd variable (lvol size). If it doesn't have a value, read the rest of the values, like this:
bdf | while read FS TOT USED AVAIL PERCENT MNT
do
if [ $FS != "Filesystem" ] # skip the header
then
if [ "$TOT" = "" ] # must be a split line
then
read TOT USED AVAIL PERCENT MNT
fi
# here's the output
echo $FS $TOT $USED $AVAIL $PERCENT $MNT
fi
done
Attached is the latest version of bdfmegs. I made a change to the divisor from 1024 down to 1000. This makes the output match bdf. For your script to monitor space, you may find options -qP90 vey useful to provide a list of filesystems greater than 90% full and without any header:
bdfmegs -qP90
bdfmegs can also look at specific volume groups (-V option) or ignore specific volume groups (-N option).
Bill Hassell, sysadmin
bdf | while read FS TOT USED AVAIL PERCENT MNT
do
if [ $FS != "Filesystem" ] # skip the header
then
if [ "$TOT" = "" ] # must be a split line
then
read TOT USED AVAIL PERCENT MNT
fi
# here's the output
echo $FS $TOT $USED $AVAIL $PERCENT $MNT
fi
done
Attached is the latest version of bdfmegs. I made a change to the divisor from 1024 down to 1000. This makes the output match bdf. For your script to monitor space, you may find options -qP90 vey useful to provide a list of filesystems greater than 90% full and without any header:
bdfmegs -qP90
bdfmegs can also look at specific volume groups (-V option) or ignore specific volume groups (-N option).
Bill Hassell, sysadmin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP