- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script for BDF
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
тАО09-12-2003 07:39 AM
тАО09-12-2003 07:39 AM
Could someone help me regardind cut comand utilization?
I'm making a script and I need to cut the 5th and 6th colums of bdf output(%used and Mounted on).
Thanks,
Leandro!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2003 07:43 AM
тАО09-12-2003 07:43 AM
Re: Script for BDF
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2003 07:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2003 07:50 AM
тАО09-12-2003 07:50 AM
Re: Script for BDF
# bdf | awk '{print $5, $6}' > /tmp/bdf_list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2003 07:50 AM
тАО09-12-2003 07:50 AM
Re: Script for BDF
awk is a possibility as in
df | awk '$1 ~ "/dev" { printf "%s %s\n",$4,$5}'
However bdf will split long lines and NFS mounts will break the above.
Here is a perl snippet that deals with all that
@FILESYSTEMS=(`df 2>/dev/null`);
while($filesystem=pop @FILESYSTEMS){
chop($filesystem);
# Dump df output we don't want
next if $filesystem =~ /.*Filesystem.*/;
next if $filesystem =~ /swap.*/;
next if $filesystem =~ /proc.*/;
# get filesystem percentage used (5th field)
($waste1,$waste2,$waste3,$waste4,$percentage,$fs)=split " ", $filesystem;
if($fs eq ""){ # A two line df filesystem
$fs=$percentage;
$percentage=$waste4;
$filesystem=pop @FILESYSTEMS;
}
next if $filesystem =~ /:/; # Lose NFS filesystems
print "Filestem $fs is $percentage used\";
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2003 08:03 AM
тАО09-12-2003 08:03 AM
Re: Script for BDF
My filename is called "useme"
cut -d" " -f5,6 useme
#cat useme
The fast brown fox chased after the lazy hare
#cut -d" " -f5,6 useme
chased after
#
The -d determines the delimter for cut to use.
Default is
Best regards,
Kent M. Ostby
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2003 04:36 AM
тАО09-15-2003 04:36 AM
Re: Script for BDF
Try this script ...
#!/bin/ksh
#
# Author : $Author: b077892 $
# Revision : $Revision: 1.1 $
# Date : $Date: 2001/05/29 16:18:25 $
#
# Header : @(#)$Header: bdf.sh $
#
bdf | awk '
BEGIN {
iLinha=0
}
{
if ( NF == 1 ) {
lin = substr( $1, 1, length( $1 ) )
} else {
iLinha++
if ( NF > 5 ) {
Linha[iLinha]=sprintf("%-30.30s %8s %8s %8s %8s %3s %s",$1,$2,$3,$4,$5,$6,$7 )
} else {
Linha[iLinha]=sprintf("%-30.30s %8s %8s %8s %8s %3s %s",lin,$1,$2,$3,$4,$5,$6 )
}
lin=""
}
}
END {
i=1
while ( i <= iLinha ) {
print Linha[i]
i++
}
}
'
You my select the fields that you need.
Best Regards.
Romildo