- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Awk syntax
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-28-2000 05:24 AM
тАО09-28-2000 05:24 AM
This is currently done using the following syntax :
space=`bdf | awk '$6 == "/" {print $5}' | cut -f1 -d"%"`
I would like to amend the script so filesystems are picked up from a configuration file instead of being hardcoded. Intended syntax is something like :
for fs in `cat filesystems`
do
space=`bdf | awk '$6 == $fs {print $5}' | cut -f1 -d"%"`
etc
Appears that value for $fs is not being determined. Awk fails with :
awk: Field $() is not correct.
The input line number is 1.
The source line number is 1.
Any ideas much appreciated.
Mike
Solved! Go to Solution.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-28-2000 05:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-28-2000 05:36 AM
тАО09-28-2000 05:36 AM
Re: Awk syntax
Do this:
Make your /tmp/stuff file like this:
/tmp
/var
/home
Then:
for fs in `cat /tmp/stuff`
do
space=`bdf|awk -v fs=$fs '$6==fs {print $5}'|cut -f1 -d"%"`
done
...adding whatever you want in the do-loop.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-28-2000 05:37 AM
тАО09-28-2000 05:37 AM
Re: Awk syntax
space=`bdf | awk -v fs=$fs '$6 == fs {print $5}' | cut -f1 -d"%"`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-28-2000 05:37 AM
тАО09-28-2000 05:37 AM
Re: Awk syntax
Do this:
Make your /tmp/stuff file like this:
/tmp
/var
/home
Then:
for fs in `cat /tmp/stuff`
do
space=`bdf|awk -v fs=$fs '$6==fs {print $5}'|cut -f1 -d"%"`
done
...adding whatever you want in the do-loop.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-28-2000 05:39 AM
тАО09-28-2000 05:39 AM
Re: Awk syntax
for fs in $(
space=$(bdf ${fs} | tail -1|awk '{print $5}')
space=${space%%\%}
etc etc
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-28-2000 05:45 AM
тАО09-28-2000 05:45 AM
Re: Awk syntax
for fs in $(
space=$(bdf ${fs} | awk '{if ($1 ~ /\//) {print $5}}')
space=${space%%\%}
etc etc...
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-28-2000 08:36 PM
тАО09-28-2000 08:36 PM
Re: Awk syntax
Use this script...
.....
current_mounted_fs=`bdf | grep "/" |
awk '{if (NF == 6) {print $6}};
(NF == 5) {print $5}'`
for fs in $current_mounted_fs
do
used_rate=`bdf $fs | grep $fs
| awk '{if (NF == 6) {print $5}};
(NF == 5) {print $4}'
| awk -F% '{print $1}'`
if [ $used_rate -gt 80 ] ; then
echo "Waring! $fs used $used_rate% ..."
fi
done
.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-28-2000 10:50 PM
тАО09-28-2000 10:50 PM
Re: Awk syntax
So you could also use double quotes in stead of single, like so :
space=`bdf | awk "$6 == $fs {print $5}" | cut -f1 -d"%"`
cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-29-2000 07:33 AM
тАО09-29-2000 07:33 AM
Re: Awk syntax
if [ "`/usr/bin/bdf | grep dev | /usr/bin/awk '{print $5}' | /usr/bin/sed 's/\%//g' | /usr/bin/awk '
{if($0>=90){print "OVER"}}
'`" != "" ]
then
# here you can send email or whatever
fi