<?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: Shell , awk or perl script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042780#M755350</link>
    <description>Danger Will Robinson!!&lt;BR /&gt;&lt;BR /&gt;Such a script is fraught with danger. How do you propose to determine that a disk is unused? Just because it isn't currently a part of LVM or VxVM doesn't mean that it is unused. You could be using raw devices -- a very common practice with databases and a less common practice with other applications. Moreover, even if the disk is unused on this system does not mean that it is not in use on another system. The only way that I ever do this is document, document, document so that I never have to ask "Now what does this disk or LUN do?".</description>
    <pubDate>Thu, 26 Apr 2007 12:25:58 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2007-04-26T12:25:58Z</dc:date>
    <item>
      <title>Shell , awk or perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042778#M755348</link>
      <description>Folks,&lt;BR /&gt;&lt;BR /&gt;I am looking for a script which will print vg name associated with each physical volume on an hpux system.&lt;BR /&gt;&lt;BR /&gt;It should scan all the volume groups &amp;amp; disks on the system (vgdisplay -v &amp;amp; ioscan -fnkC disk) and then format the output in the following format.&lt;BR /&gt;&lt;BR /&gt;/dev/dsk/c0t6d0     vg00&lt;BR /&gt;/dev/dsk/c0t5d0     vg00&lt;BR /&gt;/dev/dsk/c0t1d0     none&lt;BR /&gt;/dev/dsk/c0t2d01    vg01&lt;BR /&gt;&lt;BR /&gt;I tried writing a shell script but it is too long .. I am sure there could be a perl or awk solution to this. I would appreciate any help on this...&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Kaps</description>
      <pubDate>Thu, 26 Apr 2007 11:54:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042778#M755348</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2007-04-26T11:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Shell , awk or perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042779#M755349</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;vgdisplay 2&amp;gt;/dev/null | grep "VG Name" | awk '{print $NF}' | xargs -n1 | while read VGNAME&lt;BR /&gt;do&lt;BR /&gt;   vgdisplay -v ${VGNAME} | grep dsk | awk -v VG=${VGNAME} '{print $3,VG}'&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;If the disk is not displayed in the vgdisplayed,  then either the disk is not currently part of any volume group, an alternate link that is not added to the VG or it is part of the volume group that is not active.&lt;BR /&gt;&lt;BR /&gt;So, I dont know how useful traversing through the output of ioscan will be.</description>
      <pubDate>Thu, 26 Apr 2007 12:24:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042779#M755349</guid>
      <dc:creator>Sundar_7</dc:creator>
      <dc:date>2007-04-26T12:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Shell , awk or perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042780#M755350</link>
      <description>Danger Will Robinson!!&lt;BR /&gt;&lt;BR /&gt;Such a script is fraught with danger. How do you propose to determine that a disk is unused? Just because it isn't currently a part of LVM or VxVM doesn't mean that it is unused. You could be using raw devices -- a very common practice with databases and a less common practice with other applications. Moreover, even if the disk is unused on this system does not mean that it is not in use on another system. The only way that I ever do this is document, document, document so that I never have to ask "Now what does this disk or LUN do?".</description>
      <pubDate>Thu, 26 Apr 2007 12:25:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042780#M755350</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-04-26T12:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Shell , awk or perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042781#M755351</link>
      <description>&lt;!--!*#--&gt;Hi Kaps,&lt;BR /&gt;&lt;BR /&gt;Give this semi-tested shell script a try:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;for HWP in $(ioscan -FkC disk | cut -d: -f11)&lt;BR /&gt;do&lt;BR /&gt;    set -A HWOUT $(ioscan -fnH ${HWP})&lt;BR /&gt;    CAND=${HWOUT[((${#HWOUT[*]}-2))]}&lt;BR /&gt;    RC=$(echo ${CAND} | grep -qE '^/dev/dsk/')&lt;BR /&gt;    if [ "${RC}" -eq "0" ]&lt;BR /&gt;    then&lt;BR /&gt;        VG=$(pvdisplay ${CAND} 2&amp;gt;/dev/null |\&lt;BR /&gt;             awk '{if($1=="VG"&amp;amp;&amp;amp;$2=="Name"){sub(/\/dev\//,""); print $3}}')&lt;BR /&gt;        echo ${CAND} ${VG:-none}&lt;BR /&gt;    fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;I try to account for the case where ioscan detects a disk device that doesn't have a corresponding device file with the first usage of ioscan.  Since none of my systems meets this criterion (and I don't feel like removing device files), some guesswork is involved here.&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Thu, 26 Apr 2007 13:12:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042781#M755351</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2007-04-26T13:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Shell , awk or perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042782#M755352</link>
      <description>I am going to try each of the given options and will give you a feedback and then assign points. All I am looking for is an LVM map [ Something equivalent to lspv of aix ]. I am not worried if they are used as raw. I just wanted to know if they are not used by LVM.&lt;BR /&gt;&lt;BR /&gt;Thanks for your time and I will get back asap. &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Kaps</description>
      <pubDate>Thu, 26 Apr 2007 13:30:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042782#M755352</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2007-04-26T13:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Shell , awk or perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042783#M755353</link>
      <description>Thank you guys. spex had the script that I wanted. Thank you for your valuable time.&lt;BR /&gt;&lt;BR /&gt;Regards, Kaps</description>
      <pubDate>Thu, 26 Apr 2007 13:39:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-awk-or-perl-script/m-p/5042783#M755353</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2007-04-26T13:39:31Z</dc:date>
    </item>
  </channel>
</rss>

