- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Unix Script Help
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
Discussions
Discussions
Forums
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
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
тАО08-29-2007 06:23 AM
тАО08-29-2007 06:23 AM
Unix Script Help
Need some help.
I use command as follow :-
bdf |grep /usr |awk '{print $(NF-2)/1024/1024,$(NF-1),$NF}'
will give me the following output :
23103823 53% /usr.
How could I change the 23103823 in Kb to Gb and the output should be in integer (discard the floating).
The expected output should be :-
22 53% /usr
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2007 06:29 AM
тАО08-29-2007 06:29 AM
Re: Unix Script Help
# bdf |grep /usr |awk '{printf {printf "%4.2f\n", $(NF-2)/1024/1024,$(NF-1),$NF}'
...and you asked for an integer but what you seem to want is a 2-decimal real number as above.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2007 06:33 AM
тАО08-29-2007 06:33 AM
Re: Unix Script Help
Here is the gb enhancement:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1048509
and here is the latest version:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1124262
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2007 06:47 AM
тАО08-29-2007 06:47 AM
Re: Unix Script Help
bdf |grep /usr |awk '{print int($(NF-2)/1024/1024),$(NF-1),$NF}'
There will be no decimals or anything and it will not round up. It just strips the decimal and what is after it away.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2007 07:01 AM
тАО08-29-2007 07:01 AM
Re: Unix Script Help
~cheers