- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- grep bdf for aavail > number
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
тАО02-13-2004 12:28 AM
тАО02-13-2004 12:28 AM
grep bdf for aavail > number
Would like to know how to perform bdf, grep on 'avail' column for all filesystems greater than a given size. Also want to display all columns from bdf.
So far below cmd prints all fields (no spaces) but picks only one record from bdf (the matching one, I want to test for all > 4000000):
bdf|tr -s " " ||awk '{print $1 $2 $3 $4}'cut -f 2 -d " " |grep 4000000
thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2004 12:45 AM
тАО02-13-2004 12:45 AM
Re: grep bdf for aavail > number
I'm reasonable certain I've seen something like this before and I'm willing to bet that I saw it in one of Bill McNamara's "Favorite Scripts" threads. Here's the first one, which also provides links to the other two. Have a look through them. Even if you don't find exactly what you're looking for, they're an invaluable resource.
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=51050
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2004 12:59 AM
тАО02-13-2004 12:59 AM
Re: grep bdf for aavail > number
Try this -
for a in $(bdf |awk '{print $4}')
do
if [[ "$a" != "avail" ]]
then
if [[ $a -gt 4000000 ]]
then
echo Bigger than 4000000
fi
fi
done
Hope this works, it did on my system.
Regards,
Pete
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2004 01:03 AM
тАО02-13-2004 01:03 AM
Re: grep bdf for aavail > number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2004 01:05 AM
тАО02-13-2004 01:05 AM
Re: grep bdf for aavail > number
Since for long file system names bdf uses 2 lines this is difficult to realise easily
df -n|cut -f2 -d"("|cut -f1 -d ")"|while read line
do
xx=$(bdf $line|tail -n +2)
echo $xx|while read a b rest
do
let val=$b
if [ "$val" -gt "4000000" ]
then
echo $xx
fi
done
done|sort -n
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2004 01:08 AM
тАО02-13-2004 01:08 AM
Re: grep bdf for aavail > number
IZE=512000
OLDIFS=$IFS
IFS="
"
for LINE in `bdf`; do
FIELD2=`echo $LINE|tr -s " "|awk '{print $2 }'`
FS_SIZE=`echo $FIELD2|tr -d "[:alpha:]" `
if [[ "$FS_SIZE" -ge $SIZE ]]; then
echo $LINE
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2004 02:43 AM
тАО02-13-2004 02:43 AM
Re: grep bdf for aavail > number
Thank-you all for great and quick feedback ! I've tried all suggestions and will assign points shortly.
Mark, I'm using your suggestion, I can't get the IF to work. It appears to be comparing strings and always gives a true answer, so all bdf records are printed. I've tried several variations with no luck ... if you or anyone has a suggestion.
I mean this if:
if [[ "$FS_SIZE" -ge $SIZE ]]; then
thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2004 02:55 AM
тАО02-13-2004 02:55 AM
Re: grep bdf for aavail > number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2004 02:56 AM
тАО02-13-2004 02:56 AM
Re: grep bdf for aavail > number
bdf is not my favorite for checking the utilizations due to below warning from the man page of bdf.
WARNINGS
If file system names are too long, the output for a given entry is
displayed on two lines.
This can confuse your script quite a bit. So, I would write the script using 'df' something like this
LIMIT=100000
cleanup()
{
rm -f /tmp/fs$$ /tmp/fsreport$$
}
trap cleanup 0 1 2
for FS in $(df -l|awk '{print $1}')
do
AVAIL=$(df -k $FS|awk '/free allocated Kb/ {print $1}')
if [ $AVAIL -ge $LIMIT ]
then
bdf $FS |sed '1d'
fi
done
Adjust your if's and limits accordingly.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-13-2004 03:19 AM
тАО02-13-2004 03:19 AM
Re: grep bdf for aavail > number
bdf | tr -s " " | awk '$2>4000000'