<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic question on xargs and script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035924#M757791</link>
    <description>Hi Guys,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;used  Mounted on&lt;BR /&gt;17%  /&lt;BR /&gt;22% /stand&lt;BR /&gt;80% /var&lt;BR /&gt;&lt;BR /&gt;etc&lt;BR /&gt;&lt;BR /&gt;instead of &lt;BR /&gt;&lt;BR /&gt;17% /  22%  /stand 80% /var&lt;BR /&gt;&lt;BR /&gt;so I can then manipulate the out in a for loop&lt;BR /&gt;&lt;BR /&gt;Do you know how ?&lt;BR /&gt;is it xargs, someone said it is but dont know how to use xargs and man page is horrible on this one.&lt;BR /&gt;&lt;BR /&gt;this is the core line frm script &lt;BR /&gt;&lt;BR /&gt;echo `bdf | awk ' {print $5, $6 }'`&amp;gt; file1&lt;BR /&gt;&lt;BR /&gt;and then I want to manipulate file1 &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Noreen</description>
    <pubDate>Fri, 23 Mar 2007 09:47:48 GMT</pubDate>
    <dc:creator>NOreen Merrick</dc:creator>
    <dc:date>2007-03-23T09:47:48Z</dc:date>
    <item>
      <title>question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035924#M757791</link>
      <description>Hi Guys,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;used  Mounted on&lt;BR /&gt;17%  /&lt;BR /&gt;22% /stand&lt;BR /&gt;80% /var&lt;BR /&gt;&lt;BR /&gt;etc&lt;BR /&gt;&lt;BR /&gt;instead of &lt;BR /&gt;&lt;BR /&gt;17% /  22%  /stand 80% /var&lt;BR /&gt;&lt;BR /&gt;so I can then manipulate the out in a for loop&lt;BR /&gt;&lt;BR /&gt;Do you know how ?&lt;BR /&gt;is it xargs, someone said it is but dont know how to use xargs and man page is horrible on this one.&lt;BR /&gt;&lt;BR /&gt;this is the core line frm script &lt;BR /&gt;&lt;BR /&gt;echo `bdf | awk ' {print $5, $6 }'`&amp;gt; file1&lt;BR /&gt;&lt;BR /&gt;and then I want to manipulate file1 &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Noreen</description>
      <pubDate>Fri, 23 Mar 2007 09:47:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035924#M757791</guid>
      <dc:creator>NOreen Merrick</dc:creator>
      <dc:date>2007-03-23T09:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035925#M757792</link>
      <description>Noreen,&lt;BR /&gt;but you are there already:&lt;BR /&gt;&lt;BR /&gt;remove the echo part!&lt;BR /&gt;bdf | awk ' {print $5, $6 }' &amp;gt; file1&lt;BR /&gt;&lt;BR /&gt;gives you something like&lt;BR /&gt;%used Mounted&lt;BR /&gt;80% /&lt;BR /&gt;20% /stand&lt;BR /&gt;36% /var&lt;BR /&gt;95% /usr</description>
      <pubDate>Fri, 23 Mar 2007 09:59:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035925#M757792</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-03-23T09:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035926#M757793</link>
      <description>&amp;gt;&amp;gt;  this is the core line frm script &lt;BR /&gt;&amp;gt;&amp;gt;  echo `bdf | awk ' {print $5, $6 }'`&amp;gt; file1&lt;BR /&gt;&lt;BR /&gt;Noreen,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;free advice:&lt;BR /&gt;&lt;BR /&gt;- Is your script ready to deal with cases where the bdf line is split into two for long names?&lt;BR /&gt;&lt;BR /&gt;- 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!&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Hein van den Heuvel&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Mar 2007 10:00:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035926#M757793</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-03-23T10:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035927#M757794</link>
      <description>There is a much easier way to accomplish your task. First use Bill's attached script, bdfmegs, rather than bdf because it fixes a problem that you haven't anticipated. Download bdfmegs, make it executable, and put in somewhere in your PATH.&lt;BR /&gt;&lt;BR /&gt;then all you need to do is:&lt;BR /&gt;bdfmegs | awk '{ if ($0 ~ "^File System") next; print $(NF - 1)," ",$NF }' &amp;gt; file1&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Mar 2007 10:03:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035927#M757794</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-23T10:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035928#M757795</link>
      <description>As Peter says remove the echo. One thing to note is that if device names are long then bdf output will wrap onto next line so try the construct below:&lt;BR /&gt;&lt;BR /&gt;# bdf | awk '{if(NF&amp;gt;1) print $(NF-1), $NF}'</description>
      <pubDate>Fri, 23 Mar 2007 10:11:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035928#M757795</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-03-23T10:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035929#M757796</link>
      <description>Hi Hein/Peter,&lt;BR /&gt;&lt;BR /&gt;great I understand.&lt;BR /&gt;&lt;BR /&gt;Hein &lt;BR /&gt;&lt;BR /&gt;what do you mean&lt;BR /&gt;"Is your script ready to deal with cases where the bdf line is split into two for long names?"&lt;BR /&gt;&lt;BR /&gt;N&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Mar 2007 10:11:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035929#M757796</guid>
      <dc:creator>NOreen Merrick</dc:creator>
      <dc:date>2007-03-23T10:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035930#M757797</link>
      <description>That is what bdfmegs handles for you. bdf was designed to display in 80 columns so that if you have long mountpoint names or long filesystem names (think NFS) then the output is broken into 2 shorter lines. bdfmegs keeps every thing in 1 line in all cases.</description>
      <pubDate>Fri, 23 Mar 2007 10:16:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035930#M757797</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-23T10:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035931#M757798</link>
      <description>Hi A Clay,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I don't have the bdfmegs on my machine?&lt;BR /&gt;&lt;BR /&gt;Noreen</description>
      <pubDate>Fri, 23 Mar 2007 10:48:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035931#M757798</guid>
      <dc:creator>NOreen Merrick</dc:creator>
      <dc:date>2007-03-23T10:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035932#M757799</link>
      <description>It's a script that Bill Hassell wrote which cleans up the raw bdf output. If you had carefully examined my first posting in this thread, you would have seen the little paperclip -- the bdfmegs attachment.</description>
      <pubDate>Fri, 23 Mar 2007 10:51:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035932#M757799</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-23T10:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035933#M757800</link>
      <description>Hi A Clay,&lt;BR /&gt;&lt;BR /&gt;"Carefully read your response "???&lt;BR /&gt;&lt;BR /&gt;I know what you mean now. I was confused by the command&lt;BR /&gt;&lt;BR /&gt;bdfmegs | awk '{ if ($0 ~ "^File System") next; print $(NF - 1)," ",$NF }' &amp;gt; file1&lt;BR /&gt;&lt;BR /&gt;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" &lt;BR /&gt;&lt;BR /&gt;Anyway I think this line will do me ok for what I want &lt;BR /&gt;&lt;BR /&gt;CRITICALFSYSTEMS=`df -k | awk '{print $6, $5}' | grep [5-9][0-9]`&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;However is it ok to exceute this script on a live system or would that be very wreckless??&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks &lt;BR /&gt;&lt;BR /&gt;Noreen&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Mar 2007 11:13:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035933#M757800</guid>
      <dc:creator>NOreen Merrick</dc:creator>
      <dc:date>2007-03-23T11:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035934#M757801</link>
      <description>It's safe to run df or bdf anytime so your command is safe. You should note that your varaible might contain multiple lines so that you may not get what you expect at all times. Your grep also leaves something to be desired.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;It consists of 2 files:&lt;BR /&gt;1) check_disk_space.sh -- this attachment&lt;BR /&gt;and&lt;BR /&gt;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%.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;In any event, here is the script, check_disk_space.sh:&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Mar 2007 11:43:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035934#M757801</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-23T11:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035935#M757802</link>
      <description>and here is the configuration file, /root/conf/check_disk_space.conf:</description>
      <pubDate>Fri, 23 Mar 2007 11:44:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035935#M757802</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-23T11:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035936#M757803</link>
      <description>Great thanks, &lt;BR /&gt;&lt;BR /&gt;this will help me learn some stuff am knew to scripting.&lt;BR /&gt;Noreen</description>
      <pubDate>Fri, 23 Mar 2007 11:57:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035936#M757803</guid>
      <dc:creator>NOreen Merrick</dc:creator>
      <dc:date>2007-03-23T11:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: question on xargs and script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035937#M757804</link>
      <description>Closing</description>
      <pubDate>Fri, 23 Mar 2007 11:57:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-xargs-and-script/m-p/5035937#M757804</guid>
      <dc:creator>NOreen Merrick</dc:creator>
      <dc:date>2007-03-23T11:57:55Z</dc:date>
    </item>
  </channel>
</rss>

