- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: question on xargs and script
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
Forums
Discussions
Discussions
Forums
Discussions
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
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
03-23-2007 02:47 AM
03-23-2007 02:47 AM
i think this is easy for you. I want to send the output of 'bdf' to a file and line it up as follows e.g.
used Mounted on
17% /
22% /stand
80% /var
etc
instead of
17% / 22% /stand 80% /var
so I can then manipulate the out in a for loop
Do you know how ?
is it xargs, someone said it is but dont know how to use xargs and man page is horrible on this one.
this is the core line frm script
echo `bdf | awk ' {print $5, $6 }'`> file1
and then I want to manipulate file1
Thanks
Noreen
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 02:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:00 AM
03-23-2007 03:00 AM
Re: question on xargs and script
>> echo `bdf | awk ' {print $5, $6 }'`> file1
Noreen,
That line by itself would do exactly what you request. Something else down the pipes must be doing the re-arranging. If there is an xargs 'down the pipes' that could cause this, not solve this.
free advice:
- Is your script ready to deal with cases where the bdf line is split into two for long names?
- You mention subsequent processing in a for loop. Can awk (or perl) not do it all, right there and then? It is looping, it sees all the fields, let it do all the work!
Regards,
Hein van den Heuvel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:03 AM
03-23-2007 03:03 AM
Re: question on xargs and script
then all you need to do is:
bdfmegs | awk '{ if ($0 ~ "^File System") next; print $(NF - 1)," ",$NF }' > file1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:11 AM
03-23-2007 03:11 AM
Re: question on xargs and script
# bdf | awk '{if(NF>1) print $(NF-1), $NF}'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:11 AM
03-23-2007 03:11 AM
Re: question on xargs and script
great I understand.
Hein
what do you mean
"Is your script ready to deal with cases where the bdf line is split into two for long names?"
N
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:16 AM
03-23-2007 03:16 AM
Re: question on xargs and script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:48 AM
03-23-2007 03:48 AM
Re: question on xargs and script
I don't have the bdfmegs on my machine?
Noreen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 03:51 AM
03-23-2007 03:51 AM
Re: question on xargs and script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 04:13 AM
03-23-2007 04:13 AM
Re: question on xargs and script
"Carefully read your response "???
I know what you mean now. I was confused by the command
bdfmegs | awk '{ if ($0 ~ "^File System") next; print $(NF - 1)," ",$NF }' > file1
I thought bdfmegs was a command on it's own and not the script, but now I see you said placed "in path". There I was googling "man bdfmegs"
Anyway I think this line will do me ok for what I want
CRITICALFSYSTEMS=`df -k | awk '{print $6, $5}' | grep [5-9][0-9]`
However is it ok to exceute this script on a live system or would that be very wreckless??
Thanks
Noreen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 04:43 AM
03-23-2007 04:43 AM
Re: question on xargs and script
In any event, I have a script that I have used for many years. Normally, it produces disk alerts for ITO/VPO/OVO -- whatever the HP Name of the Month for the same product is - but I modified to simply echo to stdout.
It consists of 2 files:
1) check_disk_space.sh -- this attachment
and
2) /root/conf/check_disk_space.conf -- I'll attach in the next posting. The .conf file allows you to set a threshold value for each filesystem of interest. For example, you might get concerned if /u01 is at 45% while /u02 might be set at 90%.
This should be very close to your needs -- and because I was lazy (or smart, take your pick) I chose to use bdfmegs rather than bdf. It's also wise to limit yourself to local filesystems because you typically handle NFS filesystem capacity issues on their local host.
In any event, here is the script, check_disk_space.sh:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 04:44 AM
03-23-2007 04:44 AM
Re: question on xargs and script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 04:57 AM
03-23-2007 04:57 AM
Re: question on xargs and script
this will help me learn some stuff am knew to scripting.
Noreen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2007 04:57 AM
03-23-2007 04:57 AM