<?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 Re: capture command output in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912912#M703189</link>
    <description>Rick,&lt;BR /&gt;&lt;BR /&gt;I can not find a way to do it in one command but these two will do the trick:&lt;BR /&gt;&lt;BR /&gt;vgdisplay 2&amp;gt;/tmp/err | grep "VG Name" | awk {'print $3'} |cut -d/ -f3 &amp;gt; /tmp/out&lt;BR /&gt;grep Cannot /tmp/err|cut -d/ -f3|cut -d\" -f1&amp;gt;&amp;gt;/tmp/out&lt;BR /&gt;&lt;BR /&gt;hope this helps</description>
    <pubDate>Fri, 15 Jul 2005 12:06:26 GMT</pubDate>
    <dc:creator>Mel Burslan</dc:creator>
    <dc:date>2005-07-15T12:06:26Z</dc:date>
    <item>
      <title>capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912903#M703180</link>
      <description>Hi all:&lt;BR /&gt;&lt;BR /&gt;Trying to capture the output of the cammand vgdisplay.&lt;BR /&gt;&lt;BR /&gt;I am in a SG environment so not all VGs are active .&lt;BR /&gt;What I am doing&lt;BR /&gt;vgdisplay | awk '$0~"VG Name"{print substr($NF,6)}'&lt;BR /&gt;&lt;BR /&gt;The VGs that are not active are echoing to screen. I cannot get them into $LOG file.&lt;BR /&gt;&lt;BR /&gt;I have done 2&amp;gt;&amp;amp;1 but no luck.&lt;BR /&gt;&lt;BR /&gt;Any ideas?</description>
      <pubDate>Fri, 15 Jul 2005 10:08:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912903#M703180</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2005-07-15T10:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912904#M703181</link>
      <description>How about this?&lt;BR /&gt;&lt;BR /&gt;ls /dev/*/group |cut -f3 -d"/"</description>
      <pubDate>Fri, 15 Jul 2005 10:20:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912904#M703181</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-07-15T10:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912905#M703182</link>
      <description>Rick,&lt;BR /&gt;&lt;BR /&gt;Have you tried command grouping? I run a variation of your command on a regular basis and it works fine for me.&lt;BR /&gt;&lt;BR /&gt;# { vgdisplay | awk '$0~"VG Name"'; } &amp;gt; out_file 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;OR&lt;BR /&gt;&lt;BR /&gt;# ( vgdisplay | awk '$0~"VG Name"' ) &amp;gt; out_file 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cheers!&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Jul 2005 10:29:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912905#M703182</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-07-15T10:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912906#M703183</link>
      <description>Rick,&lt;BR /&gt;&lt;BR /&gt;I tried your command on my HP system and the only way I could get it to work was by command grouping and piping the output of your command into another awk construct. I'ave pasted the command that I ran on my system and it might be what you're looking for.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# { vgdisplay | awk '$0~"VG Name"' | awk -F"VG Name *" '{print $2}'; } &amp;gt; outfile 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;OR&lt;BR /&gt;&lt;BR /&gt;# ( vgdisplay | awk '$0~"VG Name"' | awk -F"VG Name *" '{print $2}' ) &amp;gt; outfile 2&amp;gt;&amp;amp;1  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cheers!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Jul 2005 10:43:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912906#M703183</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-07-15T10:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912907#M703184</link>
      <description>how about this?&lt;BR /&gt;&lt;BR /&gt;vgdisplay 2&amp;gt;&amp;amp;1 |grep '/dev/' |cut -f3 -d'/' |cut -f1 -d'"'</description>
      <pubDate>Fri, 15 Jul 2005 11:02:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912907#M703184</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-07-15T11:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912908#M703185</link>
      <description>script -a :)</description>
      <pubDate>Fri, 15 Jul 2005 11:15:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912908#M703185</guid>
      <dc:creator>generic_1</dc:creator>
      <dc:date>2005-07-15T11:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912909#M703186</link>
      <description>Hi folks:&lt;BR /&gt;&lt;BR /&gt;Tried the responses but what is getting to the $LOG file are the VGs that are active. And this is good.&lt;BR /&gt;&lt;BR /&gt;What I see is the following:&lt;BR /&gt;&lt;BR /&gt;vgdisplay: Volume group not activated.&lt;BR /&gt;vgdisplay: Cannot display volume group "/dev/vg1".&lt;BR /&gt;vgdisplay: Volume group not activated.&lt;BR /&gt;vgdisplay: Cannot display volume group "/dev/vg2".&lt;BR /&gt;&lt;BR /&gt;I have tried pipes, script, the /dev/group entries, etc. &lt;BR /&gt;&lt;BR /&gt;Those VGs that are cluster aware and are not presently active on a node, I cannot get into $LOG.&lt;BR /&gt;&lt;BR /&gt;In my script, here is the line I am doing&lt;BR /&gt;VG_LIST=`vgdisplay | awk '$0~"VG Name"{print substr($NF,6)}'`&lt;BR /&gt;&lt;BR /&gt;I have tried &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;gt;&amp;gt; $LOG, piping through the 'tee' command, using the script function, etc...&lt;BR /&gt;No working.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Jul 2005 11:45:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912909#M703186</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2005-07-15T11:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912910#M703187</link>
      <description>Rick, the problem is that you are searching for the string "VG Name",  on the inactive VG's that string does not appear.  &lt;BR /&gt;&lt;BR /&gt;when I use your command I get this:&lt;BR /&gt;&lt;BR /&gt;[root@pyrite] &amp;gt; VG_NAME=`vgdisplay | awk '$0~"VG Name"{print substr($NF,6)}'`&lt;BR /&gt;vgdisplay: Volume group not activated.&lt;BR /&gt;vgdisplay: Cannot display volume group "/dev/vgqdx".&lt;BR /&gt;[root@pyrite] &amp;gt; echo $VG_NAME&lt;BR /&gt;vg00 vg09 vg07 vg02 vg01 vg03 vg04 vg06 vg05&lt;BR /&gt;[root@pyrite] &amp;gt; &lt;BR /&gt;&lt;BR /&gt;by changing it to search for the string "/dev/" I get this:&lt;BR /&gt;&lt;BR /&gt;[root@pyrite] &amp;gt; VG_NAME=`vgdisplay 2&amp;gt;&amp;amp;1 |grep '/dev/' |cut -f3 -d'/' |cut -f1 -d'"'&lt;BR /&gt;[root@pyrite] &amp;gt; echo $VG_NAME&lt;BR /&gt;vgqdx vg00 vg09 vg07 vg02 vg01 vg03 vg04 vg06 vg05&lt;BR /&gt;[root@pyrite] &amp;gt; &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Jul 2005 12:00:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912910#M703187</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-07-15T12:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912911#M703188</link>
      <description>Alan:&lt;BR /&gt;&lt;BR /&gt;I do need the "Volume Groupo not active" messages in the $LOG file as well.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Jul 2005 12:02:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912911#M703188</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2005-07-15T12:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912912#M703189</link>
      <description>Rick,&lt;BR /&gt;&lt;BR /&gt;I can not find a way to do it in one command but these two will do the trick:&lt;BR /&gt;&lt;BR /&gt;vgdisplay 2&amp;gt;/tmp/err | grep "VG Name" | awk {'print $3'} |cut -d/ -f3 &amp;gt; /tmp/out&lt;BR /&gt;grep Cannot /tmp/err|cut -d/ -f3|cut -d\" -f1&amp;gt;&amp;gt;/tmp/out&lt;BR /&gt;&lt;BR /&gt;hope this helps</description>
      <pubDate>Fri, 15 Jul 2005 12:06:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912912#M703189</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-07-15T12:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912913#M703190</link>
      <description>can they be seperate entries like:&lt;BR /&gt;&lt;BR /&gt;ACT_VGs=`vgdisplay 2&amp;gt;&amp;amp;1 | awk '$0~"VG Name"{print substr($NF,6)}'`&lt;BR /&gt;INACT_VGs=`vgdisplay 2&amp;gt;&amp;amp;1 |grep '^vgdisplay:'</description>
      <pubDate>Fri, 15 Jul 2005 12:12:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912913#M703190</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-07-15T12:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912914#M703191</link>
      <description>DING DING DING&lt;BR /&gt;&lt;BR /&gt;Mel and Alan. Got it.&lt;BR /&gt;&lt;BR /&gt;Put the error handling before my pipes.&lt;BR /&gt;&lt;BR /&gt;Many thanks to all.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Jul 2005 12:17:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912914#M703191</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2005-07-15T12:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: capture command output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912915#M703192</link>
      <description>The solution.&lt;BR /&gt;&lt;BR /&gt;VG_LIST=`vgdisplay 2&amp;gt;&amp;gt;$LOG | awk '$0~"VG Name"{print substr($NF,6)}'`&lt;BR /&gt;&lt;BR /&gt;Works like a champ. I get the inactive clustered VGs as well as the active ones in the $LOG file.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Jul 2005 12:38:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/capture-command-output/m-p/4912915#M703192</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2005-07-15T12:38:36Z</dc:date>
    </item>
  </channel>
</rss>

