<?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: Help with script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405953#M352373</link>
    <description>Ok. Thanks</description>
    <pubDate>Thu, 23 Apr 2009 14:54:33 GMT</pubDate>
    <dc:creator>GTownes</dc:creator>
    <dc:date>2009-04-23T14:54:33Z</dc:date>
    <item>
      <title>Help with script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405943#M352363</link>
      <description>Hi All, &lt;BR /&gt;&lt;BR /&gt;Super novice at scripting looking for a little guidance. Trying to figure out how to get the lun wwn and first device file for the lun with awk. This is is what I get when I run the following command. &lt;BR /&gt;&lt;BR /&gt;sudo autopath display | egrep -i 'lun wwn |/dev/dsk' | awk '{print $0}'&lt;BR /&gt;&lt;BR /&gt;Lun WWN               : 6005-08B4-0006-A7DB-0000-E000-0775-0000&lt;BR /&gt; /dev/dsk/c19t0d6               Active&lt;BR /&gt; /dev/dsk/c21t0d6               Active&lt;BR /&gt; /dev/dsk/c23t0d6               Active&lt;BR /&gt; /dev/dsk/c25t0d6               Active&lt;BR /&gt; /dev/dsk/c27t0d6               Active&lt;BR /&gt; /dev/dsk/c29t0d6               Active&lt;BR /&gt; /dev/dsk/c31t0d6               Active&lt;BR /&gt; /dev/dsk/c33t0d6               Active&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How can I pull just the lun wwn and first device file ?</description>
      <pubDate>Wed, 22 Apr 2009 15:13:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405943#M352363</guid>
      <dc:creator>GTownes</dc:creator>
      <dc:date>2009-04-22T15:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405944#M352364</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;To get the lun (line) and first device file you could do:&lt;BR /&gt;&lt;BR /&gt;# sudo autopath display | awk 'NR==1 {LINE=$0};NR==2 {LINE=LINE" "$1};END{print LINE}' &lt;BR /&gt;&lt;BR /&gt;Lun WWN : 6005-08B4-0006-A7DB-0000-E000-0775-0000 /dev/dsk/c19t0d6&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 22 Apr 2009 15:22:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405944#M352364</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-22T15:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405945#M352365</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Actually, since I can't tell from your data whether or not 'autopath display' outputs more than that which you have shown, it would be better to do:&lt;BR /&gt;&lt;BR /&gt;# sudo autopath display | awk '/^Lun WWN/ {LINE=$0;getline;LINE=LINE" "$1};END{print LINE}'&lt;BR /&gt;&lt;BR /&gt;Lun WWN : 6005-08B4-0006-A7DB-0000-E000-0775-0000 /dev/dsk/c19t0d6&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 22 Apr 2009 15:31:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405945#M352365</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-22T15:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405946#M352366</link>
      <description>Jeff, &lt;BR /&gt;&lt;BR /&gt;Wasn't sure if all the line information was needed. Here's a full line section for a single lun. &lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt; Lun WWN               : 6005-08B4-0006-A7DB-0000-E000-0737-0000&lt;BR /&gt; Virtual Device File   : /hpap/dsk/hpap16&lt;BR /&gt; Load Balancing Policy : No Load Balancing&lt;BR /&gt; Lun Timeout           : Infinite Retry (-1)&lt;BR /&gt;==================================================================&lt;BR /&gt; Device Path                    Status&lt;BR /&gt;==================================================================&lt;BR /&gt; /dev/dsk/c19t0d1               Active&lt;BR /&gt; /dev/dsk/c21t0d1               Active&lt;BR /&gt; /dev/dsk/c23t0d1               Active&lt;BR /&gt; /dev/dsk/c25t0d1               Active&lt;BR /&gt; /dev/dsk/c27t0d1               Active&lt;BR /&gt; /dev/dsk/c29t0d1               Active&lt;BR /&gt; /dev/dsk/c31t0d1               Active&lt;BR /&gt; /dev/dsk/c33t0d1               Active&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I ran both commands, the first one just returns the dotted lines, and the second one just comes back to command prompt.</description>
      <pubDate>Wed, 22 Apr 2009 17:15:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405946#M352366</guid>
      <dc:creator>GTownes</dc:creator>
      <dc:date>2009-04-22T17:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405947#M352367</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;...and that's a good reason to provide not only the output you want but to offer the raw _input_.  Try this:&lt;BR /&gt;&lt;BR /&gt;# sudo autopath display | awk '/^Lun WWN/ {LINE=$0};/^\/dev/ {LINE=LINE" "$1;print LINE;exit}'&lt;BR /&gt;Lun WWN : 6005-08B4-0006-A7DB-0000-E000-0737-0000  /dev/dsk/c19t0d1&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 22 Apr 2009 17:39:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405947#M352367</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-22T17:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405948#M352368</link>
      <description>The way I read the question you'd like the first (active??) device for each Lun reported on.&lt;BR /&gt;&lt;BR /&gt;So then you do not want the exit, but you do want to stop printing after a first dev line.&lt;BR /&gt;&lt;BR /&gt;Try this for an awk command:&lt;BR /&gt;&lt;BR /&gt; awk '/^Lun WWN/ {LINE=$0};/^\/dev/&amp;amp;&amp;amp;LINE {print LINE, $1;LINE=""}'&lt;BR /&gt;&lt;BR /&gt;So if the scripts see a line starting with 'Lun', then that line is remember in variable line.&lt;BR /&gt;&lt;BR /&gt;Next, if a line starts with 'dev' AND there is something true in that variable LINE, then print LINE and the first field, and clear LINE making it false.&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Apr 2009 03:59:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405948#M352368</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2009-04-23T03:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405949#M352369</link>
      <description>Guys, thanks for awesome responses. However, perhaps I'm doing something wrong. I'm still getting just a return prompt with no output. &lt;BR /&gt;&lt;BR /&gt;I'm trying to get it to return the Lun WWN and the first device name. Here's the entire list set of luns from autopath display.  I would like to just pull the Lun WWN and the first device name for each lun. &lt;BR /&gt;&lt;BR /&gt;sudo autopath display&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt; HPswsp Version        : A.3.0F.02F.02F&lt;BR /&gt;==================================================================&lt;BR /&gt; Auto Discover         : ON&lt;BR /&gt;==================================================================&lt;BR /&gt; Array Type            : EVA-AA&lt;BR /&gt; Array WWN             : 5000-1FE1-5010-64D0&lt;BR /&gt; Read Optimize         : ON&lt;BR /&gt; Path Verification Period : 00:10&lt;BR /&gt;==================================================================&lt;BR /&gt; Lun WWN               : 6005-08B4-0006-A7DB-0000-E000-074E-0000&lt;BR /&gt; Virtual Device File   : /hpap/dsk/hpap11&lt;BR /&gt; Load Balancing Policy : No Load Balancing&lt;BR /&gt; Lun Timeout           : Infinite Retry (-1)&lt;BR /&gt;==================================================================&lt;BR /&gt; Device Path                    Status&lt;BR /&gt;==================================================================&lt;BR /&gt; /dev/dsk/c19t0d2               Active&lt;BR /&gt; /dev/dsk/c21t0d2               Active&lt;BR /&gt; /dev/dsk/c23t0d2               Active&lt;BR /&gt; /dev/dsk/c25t0d2               Active&lt;BR /&gt; /dev/dsk/c27t0d2               Active&lt;BR /&gt; /dev/dsk/c29t0d2               Active&lt;BR /&gt; /dev/dsk/c31t0d2               Active&lt;BR /&gt; /dev/dsk/c33t0d2               Active&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt; Lun WWN               : 6005-08B4-0006-A7DB-0000-E000-0751-0000&lt;BR /&gt; Virtual Device File   : /hpap/dsk/hpap12&lt;BR /&gt; Load Balancing Policy : No Load Balancing&lt;BR /&gt; Lun Timeout           : Infinite Retry (-1)&lt;BR /&gt;==================================================================&lt;BR /&gt; Device Path                    Status&lt;BR /&gt;==================================================================&lt;BR /&gt; /dev/dsk/c19t0d3               Active&lt;BR /&gt; /dev/dsk/c21t0d3               Active&lt;BR /&gt; /dev/dsk/c23t0d3               Active&lt;BR /&gt; /dev/dsk/c25t0d3               Active&lt;BR /&gt; /dev/dsk/c27t0d3               Active&lt;BR /&gt; /dev/dsk/c29t0d3               Active&lt;BR /&gt; /dev/dsk/c31t0d3               Active&lt;BR /&gt; /dev/dsk/c33t0d3               Active&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt; Lun WWN               : 6005-08B4-0006-A7DB-0000-E000-0758-0000&lt;BR /&gt; Virtual Device File   : /hpap/dsk/hpap13&lt;BR /&gt; Load Balancing Policy : No Load Balancing&lt;BR /&gt; Lun Timeout           : Infinite Retry (-1)&lt;BR /&gt;==================================================================&lt;BR /&gt; Device Path                    Status&lt;BR /&gt;==================================================================&lt;BR /&gt; /dev/dsk/c19t0d4               Active&lt;BR /&gt; /dev/dsk/c21t0d4               Active&lt;BR /&gt; /dev/dsk/c23t0d4               Active&lt;BR /&gt; /dev/dsk/c25t0d4               Active&lt;BR /&gt; /dev/dsk/c27t0d4               Active&lt;BR /&gt; /dev/dsk/c29t0d4               Active&lt;BR /&gt; /dev/dsk/c31t0d4               Active&lt;BR /&gt; /dev/dsk/c33t0d4               Active&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt; Lun WWN               : 6005-08B4-0006-A7DB-0000-E000-075B-0000&lt;BR /&gt; Virtual Device File   : /hpap/dsk/hpap14&lt;BR /&gt; Load Balancing Policy : No Load Balancing&lt;BR /&gt; Lun Timeout           : Infinite Retry (-1)&lt;BR /&gt;==================================================================&lt;BR /&gt; Device Path                    Status&lt;BR /&gt;==================================================================&lt;BR /&gt; /dev/dsk/c19t0d5               Active&lt;BR /&gt; /dev/dsk/c21t0d5               Active&lt;BR /&gt; /dev/dsk/c23t0d5               Active&lt;BR /&gt; /dev/dsk/c25t0d5               Active&lt;BR /&gt; /dev/dsk/c27t0d5               Active&lt;BR /&gt; /dev/dsk/c29t0d5               Active&lt;BR /&gt; /dev/dsk/c31t0d5               Active&lt;BR /&gt; /dev/dsk/c33t0d5               Active&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt; Lun WWN               : 6005-08B4-0006-A7DB-0000-E000-0775-0000&lt;BR /&gt; Virtual Device File   : /hpap/dsk/hpap15&lt;BR /&gt; Load Balancing Policy : No Load Balancing&lt;BR /&gt; Lun Timeout           : Infinite Retry (-1)&lt;BR /&gt;==================================================================&lt;BR /&gt; Device Path                    Status&lt;BR /&gt;==================================================================&lt;BR /&gt; /dev/dsk/c19t0d6               Active&lt;BR /&gt; /dev/dsk/c21t0d6               Active&lt;BR /&gt; /dev/dsk/c23t0d6               Active&lt;BR /&gt; /dev/dsk/c25t0d6               Active&lt;BR /&gt; /dev/dsk/c27t0d6               Active&lt;BR /&gt; /dev/dsk/c29t0d6               Active&lt;BR /&gt; /dev/dsk/c31t0d6               Active&lt;BR /&gt; /dev/dsk/c33t0d6               Active&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt; Lun WWN               : 6005-08B4-0006-A7DB-0000-E000-0737-0000&lt;BR /&gt; Virtual Device File   : /hpap/dsk/hpap16&lt;BR /&gt; Load Balancing Policy : No Load Balancing&lt;BR /&gt; Lun Timeout           : Infinite Retry (-1)&lt;BR /&gt;==================================================================&lt;BR /&gt; Device Path                    Status&lt;BR /&gt;==================================================================&lt;BR /&gt; /dev/dsk/c19t0d1               Active&lt;BR /&gt; /dev/dsk/c21t0d1               Active&lt;BR /&gt; /dev/dsk/c23t0d1               Active&lt;BR /&gt; /dev/dsk/c25t0d1               Active&lt;BR /&gt; /dev/dsk/c27t0d1               Active&lt;BR /&gt; /dev/dsk/c29t0d1               Active&lt;BR /&gt; /dev/dsk/c31t0d1               Active&lt;BR /&gt; /dev/dsk/c33t0d1               Active&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt;&lt;BR /&gt;==================================================================&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Apr 2009 13:54:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405949#M352369</guid>
      <dc:creator>GTownes</dc:creator>
      <dc:date>2009-04-23T13:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405950#M352370</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;It looks to me like Hein's variation returns what you want.  Copying and pasting Hein's code and running it with your most recent input as posted gave me:&lt;BR /&gt;&lt;BR /&gt;Lun WWN : 6005-08B4-0006-A7DB-0000-E000-074E-0000 /dev/dsk/c19t0d2&lt;BR /&gt;Lun WWN : 6005-08B4-0006-A7DB-0000-E000-0751-0000 /dev/dsk/c19t0d3&lt;BR /&gt;Lun WWN : 6005-08B4-0006-A7DB-0000-E000-0758-0000 /dev/dsk/c19t0d4&lt;BR /&gt;Lun WWN : 6005-08B4-0006-A7DB-0000-E000-075B-0000 /dev/dsk/c19t0d5&lt;BR /&gt;Lun WWN : 6005-08B4-0006-A7DB-0000-E000-0775-0000 /dev/dsk/c19t0d6&lt;BR /&gt;Lun WWN : 6005-08B4-0006-A7DB-0000-E000-0737-0000 /dev/dsk/c19t0d1&lt;BR /&gt;&lt;BR /&gt;Isn't this what you want?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Apr 2009 14:04:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405950#M352370</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-23T14:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405951#M352371</link>
      <description>Hi JRF, &lt;BR /&gt;&lt;BR /&gt;Yes, thats exactly what I want it to do. I am copying and pasting the exact syntax, but for some reason its not working for me. I am not sure why its not working for me. Guess I'll keep playing around with it till I can get it to work. &lt;BR /&gt;&lt;BR /&gt;Thanks for your help. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;G</description>
      <pubDate>Thu, 23 Apr 2009 14:15:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405951#M352371</guid>
      <dc:creator>GTownes</dc:creator>
      <dc:date>2009-04-23T14:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405952#M352372</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;One way you would _not_ the correct output is if the target strings were preceeded by whitespace.  Remember that our solutions anchored ('^') things to the beginning of a line:&lt;BR /&gt;&lt;BR /&gt;/^Lun WWN/&lt;BR /&gt;&lt;BR /&gt;...and...&lt;BR /&gt;&lt;BR /&gt;/^\/dev/ &lt;BR /&gt;&lt;BR /&gt;mean that the character sequences only match if they are the first characters on a line.  &lt;BR /&gt;&lt;BR /&gt;I would examine your output thusly:&lt;BR /&gt;&lt;BR /&gt;# sudo autopath display | cat -etv &lt;BR /&gt;&lt;BR /&gt;You could be less rigorous by doing:&lt;BR /&gt;&lt;BR /&gt;# awk '/Lun WWN/ {LINE=$0};/\/dev/  ...&lt;BR /&gt;&lt;BR /&gt;...or better (if whitespace preceeding is allowed):&lt;BR /&gt;&lt;BR /&gt;# awk '/[[:space:]]*Lun WWN/ {LINE=$0};/[[:space:]]*\/dev/ &amp;amp;&amp;amp; LINE {print LINE, $1;LINE=""}' &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 23 Apr 2009 14:37:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405952#M352372</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-23T14:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help with script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405953#M352373</link>
      <description>Ok. Thanks</description>
      <pubDate>Thu, 23 Apr 2009 14:54:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/4405953#M352373</guid>
      <dc:creator>GTownes</dc:creator>
      <dc:date>2009-04-23T14:54:33Z</dc:date>
    </item>
  </channel>
</rss>

