GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Another scripting problem
Operating System - HP-UX
1844876
Members
2040
Online
110233
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
Forums
Discussions
Discussions
Discussions
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
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-02-2008 05:20 AM
09-02-2008 05:20 AM
Hi all,
Somebody must have done this in the past. I have a problem whereby when I do a bdf the lvol and the filesystem are on different lines. I want to run a command for example that simply uses awk to put each lvol and relevant filesystem into a file. Thing is if I grep the lvol I lose the filesystem and vica versa. I thought about reading the output of bdf in line by line but still not sure how that would work.
Cheers
Somebody must have done this in the past. I have a problem whereby when I do a bdf the lvol and the filesystem are on different lines. I want to run a command for example that simply uses awk to put each lvol and relevant filesystem into a file. Thing is if I grep the lvol I lose the filesystem and vica versa. I thought about reading the output of bdf in line by line but still not sure how that would work.
Cheers
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2008 05:25 AM
09-02-2008 05:25 AM
Solution
Hi Adam:
Bill Hassell has an elegant script that accomodates your problem while making the standard 'bdf' much handier!
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1124262
Regards!
...JRF...
Bill Hassell has an elegant script that accomodates your problem while making the standard 'bdf' much handier!
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1124262
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2008 05:36 AM
09-02-2008 05:36 AM
Re: Another scripting problem
Yes, other folks have done this before :-)
Both stumbling into the line split, as well at taking the next step to tie the data up with lvm.
First step is to see wether 'df' instead of 'bdf' works for you.
Some prior posts with pointers to solutions:
(google: +awk +bdf +split +site:itrc.hp.com)
http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=440647
http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1218175
Both stumbling into the line split, as well at taking the next step to tie the data up with lvm.
First step is to see wether 'df' instead of 'bdf' works for you.
Some prior posts with pointers to solutions:
(google: +awk +bdf +split +site:itrc.hp.com)
http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=440647
http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1218175
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2008 06:43 AM
09-03-2008 06:43 AM
Re: Another scripting problem
The simple answer is to use read to process each line from bdf and test if the 2nd value (total Kbytes) is null. If true, read again to pickup the rest of the values, something like this:
bdf | while read FS TOT USED AVAIL PERCENT MNT
do
[ "TOT" = "" ] && read TOT USED AVAIL PERCENT MNT
echo "$FS $TOT $USED $AVAIL $PERCENT $MNT"
done
The test for "TOT" triggers another read for line 2 to pickup the rest of the values. The echo line is just to show the one line results.
Bill Hassell, sysadmin
bdf | while read FS TOT USED AVAIL PERCENT MNT
do
[ "TOT" = "" ] && read TOT USED AVAIL PERCENT MNT
echo "$FS $TOT $USED $AVAIL $PERCENT $MNT"
done
The test for "TOT" triggers another read for line 2 to pickup the rest of the values. The echo line is just to show the one line results.
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.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP